Search code examples
instagraminstagram-apiinstagram-graph-api

Instagram Graph API Access Token


So I've setup and configured my Instagram Graph API and have the media loading on my website, but I wanted to check with the community whether the access token that is received expires or is permanent. Facebook support is terrible and I was not able to get a response from them.

The below details are from the access token debugger:

enter image description here

Will the above access token need to be renewed every 3 months or does it not expire ever? We have two authenticated users logged in via Facebook that has access to the permissions for the media on the Instagram account.

Does the access token refresh each day when a user is active? It's so hard to understand the process.

Thanks so much!


Solution

  • According to: https://developers.facebook.com/docs/facebook-login/access-tokens/refreshing - if you've exchanged the short-lived token for a long-lived one (which it seems you did), they should not expire if the user visits your site within a 60 day period.

    When you use the iOS, Android, or JavaScript SDK, the SDK will automatically refresh tokens if the person has used your app within the last 90 days. Native mobile apps using Facebook's SDKs get long-lived User access tokens, good for about 60 days. These tokens are refreshed once per day, when the person using your app makes a request to Facebook's servers. If no requests are made, the token will expire after about 60 days and the person will have to go through the login flow again to get a new token.

    As far as I know this applies to Instagram Graph API tokens as well.