Question

I have an access token. I want to check the access token is valid or not using php-sdk. Is anyway to check the access token is valid or not ?

Was it helpful?

Solution

The access_token can be used without using the App ID and Secret. You can simply make a API call to https://graph.facebook.com/me?access_token=xxx. If the access_token is valid, the user's information will be viewable. If the access_token is invalid you'll get an error:

{
   "error": {
      "message": "Error validating access token: Session has expired on Mar 13, 2014 5:00am. The current time is Mar 19, 2014 8:25am.",
      "type": "OAuthException",
      "code": 190,
      "error_subcode": 463
   }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top