我使用Facebook的PHP SDK(V4)无效appsecret_proof安装SDK后获取用户信息, ,我添加代码图表返回了一个错误:在API参数提供
$fb = new Facebook\Facebook([
'app_id' => 'my app id',
'app_secret' => 'my app secret',
'default_graph_version' => 'v2.5',
]);
try {
// Returns a `Facebook\FacebookResponse` object
$access_token= //copied from my https://developers.facebook.com/tools/explorer/
$response = $fb->get('/me?fields=id,name', '$access_token');
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$user = $response->getGraphUser();
echo 'Name: ' . $user['name'];
但是当我运行网页它给了我这个错误,
Graph returned an error: Invalid appsecret_proof provided in the API argument
我正在正确地复制应用程序的秘密,这可能是对这种错误的原因和我应该如何解决这一问题?
我不小心将APP_ID复制到了APP_SECRET。感谢这个答案。 –