'How to refresh access token. Without opening graph API explorer ? In facebook GraphAPI

According to https://developers.facebook.com/docs/instagram-basic-display-api/reference/refresh_access_token/ , to refresh a long term access token , which you can get from user access token.

I am calling GET request on URL

https://graph.instagram.com/refresh_access_token
  ?grant_type=ig_refresh_token
  &access_token={long-lived-access-token}

It returns

Sorry, this content isn't available right now

Is there any other way by which I can refresh access_tokens automatically by calling GET requests on URLs.



Solution 1:[1]

If you are already have the Long-lived access token then you can't refresh it manually

When user login using facebook login button what you get is a short lived access token you use this endpoint to get a long lived access token

curl -i -X GET "https://graph.facebook.com/{graph-api-version}/oauth/access_token?  
    grant_type=fb_exchange_token&          
    client_id={app-id}&
    client_secret={app-secret}&
    fb_exchange_token={your-access-token}" 

after you got the long lived token it's will refresh once per day automatically if the user is using your app means the token is being used, if the token is not being used after 60 days the user must go through the login flow again in order to get a new token read more here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sarkar