Search code examples
facebookfacebook-graph-apifacebook-rest-api

Is there a way to check if Facebook access token is still valid?


My site utilizes lifetime access tokens (offline_access). However, if the user changes his/her password, the access token gets reset. Is there a method to check if the current access token is valid before making calls to the Graph API? Thanks for your time.


Solution

  • Basically, FB wants you to poll for it, or to detect the case and redirect the user to get a reauth to occur. Annoying, but official:

    (Old, out of date link. See below) https://developers.facebook.com/blog/post/500/

    Edit: Facebook changed their link structure without redirects. Not surprised.

    https://developers.facebook.com/blog/post/2011/05/13/how-to--handle-expired-access-tokens/