Obtain new Access Token without Facebook Login

寵の児 提交于 2019-12-13 06:42:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!