无法使用iframe标签访问Facebook signed_request [英] Cannot access Facebook signed_request with an iframe tab
问题描述
我有一个iframe加载在粉丝页面的Facebook选项卡,我没有运气访问$ _REQUEST [signed_request]对象。我很困惑,因为这应该是一个免费的,容易访问的。我已阅读并重新阅读了facebook文档,并重新检查了我的Facebook应用程序设置,但没有任何工作。
I've got an iframe loading in a facebook tab on a fan page and I'm not having any luck accessing the $_REQUEST["signed_request"] object. I'm confused because this is supposed to be a freebie and easily accessible. I've read and re-read the facebook docs and rechecked my facebook application settings but nothing is working.
isset($_REQUEST['signed_request']
总是错误,因为我使用Facebook PHP sdk也试过
is always false. Since I'm using the Facebook PHP sdk I've also tried
$facebook->getSignedRequest();
我在$ _REQUEST上完成了print_r,我没有看到signed_request,当我打印$ facebook对象时,我看到signedRequest为空
I've done print_r on the $_REQUEST and I don't see the signed_request in there. When I print_f the $facebook object, I see that the signedRequest is empty
[appId:protected] => XXX
[apiSecret:protected] => XXXXXXXXXXXXXXXXXXXX
[session:protected] => Array
[access_token] => XXXXXXXXXX|2.h75WqKxcA1xbNPufFvpKQQ__.3600.1304452800.1-726960374|JiO0ZS30SyLaApeqhMtdocK8B_Y
[base_domain] => XXXXXXXXX
[expires] => 1304452800
[secret] => rDF9C_z43_EUFy0Q_e6tyQ__
[session_key] => 2.h75WqKxcA1xbNPufFvpKQQ__.3600.1304452800.1-726960374
[sig] => 1971ef7eb8057c7404eae1f82d770ab5
[uid] => XXXXXXXXXXXXXXX
[signedRequest:protected] =>
[sessionLoaded:protected] => 1
[cookieSupport:protected] => 1
[baseDomain:protected] =>
[fileUploadSupport:protected] =>
我的应用程序启用了OAuth 2.0设置。 p>
I do have the OAuth 2.0 setting enabled for the application.
推荐答案
经过调查,我怀疑这与iframe源的托管位置有关。
After some investigation, I suspect this has something to do with where the iframe source is hosted.
当我将所有内容移至localhost时,signed_request开始进行。
When I moved everything to localhost, the signed_request started coming in fine.
这篇关于无法使用iframe标签访问Facebook signed_request的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!