Samnad Sainulabdeen
Samnad Sainulabdeen

Reputation: 240

How to check the access token is valid or not without using appId and secret?

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 ?

Upvotes: 3

Views: 4579

Answers (1)

Niraj Shah
Niraj Shah

Reputation: 15457

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
   }
}

Upvotes: 8

Related Questions