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;
}
你有解决方案吗? 谢谢你。