I am using the PHP SDK to handle my Facebook connects. Everything was working fine for some time but my script suddenly stopped working. Here is what happens:
$facebook = new Facebook(array('appId' => $app_id, 'secret' => $app_secret, 'cookie' => true));
$user = $facebook->getUser();
if ($user) {
$permissions = $facebook->api('/me/permissions');
} else {
$params = array();
$params['scope'] = 'publish_actions,user_photos';
header('Location: ' . $facebook->getLoginUrl($params));
exit();
}
Returns: Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user.
The error is caused by the line
$permissions = $facebook->api('/me/permissions');
Any suggestions?