Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Both tokens expire because they are the same user token. </p> <p>In the PHP SDK, if the token expires or gets thrown out for some error, the PHP SDK will set the default token to the application token</p> <p><a href="https://github.com/facebook/facebook-php-sdk/blob/master/src/base_facebook.php#L389" rel="nofollow">https://github.com/facebook/facebook-php-sdk/blob/master/src/base_facebook.php#L389</a></p> <pre><code> /** * Determines the access token that should be used for API calls. * The first time this is called, $this-&gt;accessToken is set equal * to either a valid user access token, or it's set to the application * access token if a valid user access token wasn't available. Subsequent * calls return whatever the first call returned. * * @return string The access token */ public function getAccessToken() { if ($this-&gt;accessToken !== null) { // we've done this already and cached it. Just return. return $this-&gt;accessToken; } // first establish access token to be the application // access token, in case we navigate to the /oauth/access_token // endpoint, where SOME access token is required. $this-&gt;setAccessToken($this-&gt;getApplicationAccessToken()); $user_access_token = $this-&gt;getUserAccessToken(); if ($user_access_token) { $this-&gt;setAccessToken($user_access_token); } return $this-&gt;accessToken; } </code></pre> <p>Thus you must introduce login handling in PHP to ensure no calls are taken unless a valid user access token is supplied.</p> <p>In JS SDK, most setups unless you explicitly set it otherwise will push the user through login after token expiry.</p> <p>As you describe it seems as though an error is pushing the PHP SDK to use the default application token.</p> <p>You can even sure that the user access token being used in the JS SDK will work in the PHP SDK <em>if it is indeed still active</em>, by setting it</p> <pre><code>$facebook-&gt;setAccessToken('YOUR_ACCESS_TOKEN_IN_JS_SDK'); </code></pre> <p>Once this works then the error elsewhere in your code (which you have not supplied).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload