Facebook Graph API:appsecret_proof和PHP SDK v.3.2.3的问题 [英] Facebook Graph API: issue with appsecret_proof and PHP SDK v.3.2.3
问题描述
我有一个奇怪的问题,该问题从昨天(2015年7月20日)开始出现.自2014年8月以来(差不多一年),我的脚本运行良好,但现在拒绝了.如果我在Facebook上发布图片或文本,则会收到此服务器错误消息:
I have a strange issue, that appears since yesterday (07/20/2015). My script worked perfectly since August 2014, so nearly a year, but now it rejects working. If I post a picture or a text to Facebook, I get this server error message:
PHP致命错误:未被捕获的GraphMethodException:无效 API参数中提供的appsecret_proof \ n抛出 .../base_facebook.php在第1329行
PHP Fatal error: Uncaught GraphMethodException: Invalid appsecret_proof provided in the API argument\n thrown in .../base_facebook.php on line 1329
这是 Facebook PHP PHP中的函数 throwAPIException 中的一行. SDK(v.3.2.3).我知道,这与 Require App Secret (需要App Secret)选项有关(在Facebook Devs-> Apps-> Settings-> Advanced中).此选项已停用一年,所以也许我必须在脚本中添加一些新内容?
This is a line in the function throwAPIException in the Facebook PHP SDK (v.3.2.3). I know, it has something to do with with the option Require App Secret (in Facebook Devs -> Apps -> Settings -> Advanced). This option is deactivated for a year, so maybe I have to add something new to my script?
在此stackoverflow中-post 我发现在调用时添加此行的提示:
In this stackoverflow-post I found a hint to add this line while calling:
FacebookSession::enableAppSecretProof(false);
...但是这与更新的SDK v.4有关,与v.3不相关.在我的脚本中,我使用以下命令调用SDK v.3:
...but this is related to the newer SDK v.4, not to v.3. In my script, I call the SDK v.3 with:
$facebook = new Facebook(array( 'appId' => $App_ID, 'secret' => $App_Secret, 'cookie' => true ));
$facebook->setAccessToken($Access_Token);
是否可以在其中的任何位置添加 enableAppSecretProof ?感谢您的帮助! :-)
Is there a way to add enableAppSecretProof anywhere there? Thanks for helping me! :-)
推荐答案
Solution: in line 918 of the base_facebook.php you have to comment these three lines
# if (isset($params['access_token']) && !isset($params['appsecret_proof'])) {
# $params['appsecret_proof'] = $this->getAppSecretProof($params['access_token']);
# }
就是这样.
这篇关于Facebook Graph API:appsecret_proof和PHP SDK v.3.2.3的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!