An active access token must be used to query information about the current user

Facebook Error: An active access token must be used to query information about the current user.

This error occurs when the Access Token for the account you are accessing has expired or cannot be authenticated.

Typically this is happening at the point when calling /me or something similar on the Graph API.

What is every likely happening, if using the Facebook PHP SDK is that the the state is not valid, or the cookes are not being set properly.

Error with State

The code below causes this exception, because the 'state' variable is not being handled properly.

// Redirect to Login
$fb = new Facebook(APP_ID,SECRET);
$uri = $fb->getLoginUrl(array(
    'scope' => 'email,user_likes',
    'state' => 'some-fixed-value',
    'redirect_uri' => sprintf('http://%s/auth/facebook?a=auth',$_SERVER['SERVER_NAME']),
));

// Handle Callback


Error with Cookie

Code like this could could be throwing the error. Take out the cookie => true option and test again.

See Also