Trying to refresh my long lived access token via this endpoint:
https://developers.facebook.com/docs/instagram-basic-display-api/guides/long-lived-access-tokens#refresh-a-long-lived-token
Keep getting the error: OAuth "Facebook Platform" "invalid_token" "Invalid OAuth access token."
However, I debug my token using https://developers.facebook.com/tools/debug/accesstoken/ which shows that it is valid and for around 2 months (which proves its a long lived access token).
Does this endpoint not work anymore or am I missing something?
P.S. I'm using a User Access Token, its a public Instagram business account backed by a Facebook page. Also, I'm using this on server, so it won't refresh if the token is used within 60 days (that's what happens when you auth through FB mobile sdk).
EDIT
So it looks like there are two requirements that I missed:
- Your long lived access token has to be at least 24 hours old in order to refresh
- You need the 'instagram_graph_user_profile' permission/scope when logging your user into Facebook
HOWEVER
I tried:
- Oddly enough, whenever I add that permission/scope to the list, Facebook Login always fails and says "There's something wrong". I tried this using the facebook login react npm package, the manual login flow by just making requests, and the FB SDK login button, all the same result.
- The Facebook Graph API Explorer doesn't include this permission. However, the list of permissions they have does include it.
So what does this mean, Facebook isn't allowing refresh of long lived tokens?
NOTE: The docs on how to refresh a long lived access token are for the Basic Display API, which isn't recommended for business accounts (which is who will be using my app). So this makes me more unsure of if it is possible to refresh tokens for the Instagram Graph API.
MORE INFO
So on the FB developer portal, if you add the Instagram Basic Display product to your app (I previously didn't have it) it allows you to ask for the instagram_graph_user_profile
permission. However, this brings up more questions:
- Do I have to use Insta Graph API + Insta Basic Display in order to get a a refreshable long lived access token?
- If so, how does that work? Because Insta Basic Display is recommended for personal accounts and Graph API is for business accounts.
- If so, how do I add the
instagram_graph_user_profile
permission? It still causes FB login to fail.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…