Facebook PHP SDK misbehaving after December '12 updates-Collection of common programming errors
I’m using the PHP (with js) SDK for authentication around my website. Until now I’ve never had a problem with access tokens and everything has run smoothly. Since the latest updates have been pushed I’m receiving a lot of:
Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in /home/content/54/9505854/html/src/fb/base_facebook.php on line 1106
The access tokens seem to be invalidated (or irretrievable) whenever there is a PHP call to the API. I made a simple page that uses and this has always simply returned the current access token as expected:
//Facebook PHP SDK
require_once 'src/fb/facebook.php';
//Config
$facebook = new Facebook(array(
'appId' => '...id...',
'secret' => '...secret...',
));
$accessToken = $facebook->getAccessToken();
die($accessToken);
This page still works if loaded immediately after javascript authentication but any navigation away from this page (or indeed a refresh) this script will return the appID and secret as a string in the form [appID]|[secret]
Basically any call to the Facebook object makes the next page navigation unauthenticated.
Also I am not currently storing the retrieved access token as a cookie or in mySQL. Should I?
Any insight into the problem or solution would be really helpful! Thanks
Originally posted 2013-11-30 17:54:02.