问题
Is there a way to request a new access token (with an expired token) without the user logging in again? There has to be way that Facebook can refresh the app token without requiring user input. This needs to be done server-side and not client side.
UPDATE: I forgot to mention that I already have a long-lived token. I want to refresh and get a new one before it expires.
回答1:
Yes. Before the token is expiring, make an http request to-
https://graph.facebook.com/oauth/access_token?
grant_type=fb_exchange_token&
client_id=APP_ID&
client_secret=APP_SECRET&
fb_exchange_token=SHORT_LIVED_ACCESS_TOKEN
This will give you a fresh token with 2 months validity.
For more details- extending-tokens
回答2:
it's possible to extend the lifetime of an access token to 60 days maximum. have a look here: https://developers.facebook.com/roadmap/offline-access-removal/
if an user is not returning for more than 60 days, there's no way to obtain a new user access token.
来源:https://stackoverflow.com/questions/14707619/obtain-new-access-token-without-facebook-login