Graph returned an error: This authorization code has been used.
hminvozone opened this issue · 1 comments
hminvozone commented
I am using the SDK 5.7 version, customer redirected to the facebook login page and redirected back successfully however see This authorization code has been used. error on redirected page.
I have checked this page https://developers.facebook.com/tools/accesstoken/ and I can see the access token
Can any one help?
$fb = new Facebook\Facebook([
'app_id' => 'xxxxx',
'app_secret' => 'xxxxxx',
'default_graph_version' => 'v2.10',
]);
$helper = $fb->getRedirectLoginHelper($redirectUrl);
if (isset($_GET['state'])) {
$helper->getPersistentDataHandler()->set('state', $_GET['state']);
}
$permissions = ['email']; // optional
if (isset($_GET['code'])) {
try {
$accessToken = $helper->getAccessToken();
} catch (FacebookRequestException $e) {
echo 'Request error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookResponseException $e) {
// When Graph returns an error
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
// When validation fails or other local issues
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
} catch (Exception $e) {
echo 'Generic error: ' . $e->getMessage();
exit;
}
} else {
redirectUrl($helper->getLoginUrl($redirectUrl, $permissions));
}
hminvozone commented
@sergeychernyshev @zpao @killian @klausbreyer guys can you help me out?