Facebook SDK v5错误:跨站点请求伪造验证失败。必需的参数"州"失踪

时间:2015-12-18 19:38:18

标签: php facebook sdk

Facebook SDK v5

Facebook Graph v2.4

我收到此错误:

Facebook SDK returned an error: Cross-site request forgery validation failed. Required param "state" missing.

这是我的代码:

$facebookAppId = Configure::read(('Facebook.appId'));
$facebookAppSecret = Configure::read(('Facebook.appSecret'));

$this->fb = new Facebook(['app_id' => $facebookAppId,
                          'app_secret' => $facebookAppSecret,
                          'default_graph_version' => 'v2.4',
                          'default_access_token' => $facebookAppId.'|'.$facebookAppSecret]);

$helper = $this->fb->getRedirectLoginHelper();

try {
    $accessToken = $helper->getAccessToken();
} catch(FacebookResponseException $e) {
    // When Graph returns an error
    echo 'Graph returned an error: ' . $e->getMessage();
    exit;
} catch(FacebookSDKException $e) {
    // When validation fails or other local issues
    echo 'Facebook SDK returned an error: ' . $e->getMessage();
    exit;
}

你有解决方案吗? 谢谢你。

0 个答案:

没有答案