facebookarchive / php-graph-sdk

The Facebook SDK for PHP provides a native interface to the Graph API and Facebook Login. https://developers.facebook.com/docs/php
Other
3.17k stars 1.96k forks source link

This authorization code has expired #1124

Open walker6o9 opened 5 years ago

walker6o9 commented 5 years ago

Expected to receive an access token Code Samples The user is sending the following out:

https://www.facebook.com/v2.10/dialog/oauth?client_id=992150620993178&state=125a979303c0b7504e6001c976ce24ad&response_type=code&sdk=php-sdk-5.6.3&redirect_uri=https%3A%2F%2Fmycollabkit.com%2Fsite%2Faccounts&scope=email%2Cmanage_pages%2Cread_insights%2Cinstagram_basic%2Cpages_show_list%2Cinstagram_manage_insights

And I'm receiving back:

Error Message 100: This authorization code has expired

This happens to certain users only. There is no significant time lapse between when the request is sent and received.

alupher commented 3 years ago

We are seeing the same issue on our end. A small but significant percentage of users are unable to use Facebook login because this error occurs repeatedly, no matter how many times they try to authenticate. There is not significant time lapse between the requests here either.

Unfortunately, we have not been able to reproduce this behavior on our own accounts, so we only see this in logs and in user support requests.

We're using a standard oauth integration as described here: https://developers.facebook.com/docs/facebook-login/web, so the client sends out a request to the facebook oauth endpoint as @walker6o9 described above.

After authenticating, the user is redirected back to us, where we do:

$helper = $fb->getJavaScriptHelper();
$accessToken = $helper->getAccessToken();
// ^ This throws Facebook\\Exceptions\\FacebookAuthenticationException: 
// "This authorization code has expired. in /vendor/facebook/graphsdk/src/Facebook/Exceptions/FacebookResponseException.php"
//  for some users 

Any ideas?