{"id":1741,"date":"2022-08-30T15:19:03","date_gmt":"2022-08-30T15:19:03","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/30\/facebook-php-sdk-misbehaving-after-december-12-updates-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:19:03","modified_gmt":"2022-08-30T15:19:03","slug":"facebook-php-sdk-misbehaving-after-december-12-updates-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/facebook-php-sdk-misbehaving-after-december-12-updates-collection-of-common-programming-errors\/","title":{"rendered":"Facebook PHP SDK misbehaving after December &#39;12 updates-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m using the PHP (with js) SDK for authentication around my website. Until now I&#8217;ve never had a problem with access tokens and everything has run smoothly. Since the latest updates have been pushed I&#8217;m receiving a lot of:<\/p>\n<blockquote>\n<p><strong>Fatal error<\/strong>: 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<\/p>\n<\/blockquote>\n<p>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:<\/p>\n<pre><code>\/\/Facebook PHP SDK\nrequire_once 'src\/fb\/facebook.php'; \n\n\/\/Config\n$facebook = new Facebook(array(\n  'appId'  =&gt; '...id...',\n  'secret' =&gt; '...secret...',\n));\n\n$accessToken = $facebook-&gt;getAccessToken();\ndie($accessToken); \n<\/code><\/pre>\n<p>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 <code>[appID]|[secret]<\/code><\/p>\n<p>Basically any call to the Facebook object makes the next page navigation unauthenticated.<\/p>\n<p>Also I am not currently storing the retrieved access token as a cookie or in mySQL. Should I?<\/p>\n<p>Any insight into the problem or solution would be really helpful! Thanks<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-30 17:54:02. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;m using the PHP (with js) SDK for authentication around my website. Until now I&#8217;ve never had a problem with access tokens and everything has run smoothly. Since the latest updates have been pushed I&#8217;m receiving a lot of: Fatal error: Uncaught OAuthException: An active access token must be used to query information about the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1741","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1741","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1741"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1741\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1741"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}