Facebook iframe 选项卡签名请求始终为空
我正在开发 Facebook 应用程序选项卡,并希望使用此处记录的签名请求包: http://developers.facebook.com/blog/post/462/
我'我尝试使用他们的示例代码来解包签名的请求,该请求据称会传递给但是,$_POST
、$_GET
和 $_REQUEST
始终为空。
确切的代码在画布页面上运行,我能够解析签名的请求。
他们最近的公告中是否有我遗漏的内容?
顺便说一句,该应用程序未发布到市场,并且我的选项卡安装的粉丝页面是私有的。这会有所不同吗?
-赛斯
I'm working on a Facebook app tab and would like to use the signed request bundle as documented here:
http://developers.facebook.com/blog/post/462/
I'm trying to use their example code to unpackage the signed request which is supposedly passed to the tab, however, $_POST
, $_GET
, and $_REQUEST
are always all empty.
The exact code works on the canvas page and I am able to parse the signed request.
Is there something that I'm missing in their recent announcement?
By the way, the app is not published to the marketplace, and the fanpage my tab is installed on is private. Will that make a difference?
-Seth
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
好吧,想通了!
配置应用程序时,我将“Tab URL”填写为“tab/”
这使得标签页的完整网址为“http://www.example.com/ myfacebookapp/tab/”
这对我来说很有意义。
显然,Facebook 不喜欢这样。将我的“选项卡 URL”更改为“tab/index.php”后,签名的请求开始显示在应用程序选项卡中!
Okay, figured it out!
When configuring the app, I had filled in the "Tab URL" to be "tab/"
This made the full url to the tab page "http://www.example.com/myfacebookapp/tab/"
This made sense to me.
Apparently, Facebook doesn't like this. After changing my "Tab URL" to 'tab/index.php", the signed request started to show up in the app tab!
本质上,问题在于您的网络服务器在收到请求时正在执行重定向。在您的情况下,它从 http://www.example.com/myfacebookapp/tab/ 到 http://www.example.com/myfacebookapp/tab/index.php ;就我而言,它是从 http://www.example.com/myfacebookapp/tab 重定向的到 http://www.example.com/myfacebookapp/tab/ (我的应用程序是内置于 .Net MVC,因此没有文件名,但显然需要尾部斜杠)。
因此,规范的解决方案是确保选项卡 URL 字段中的路径是实际的 URL,而不是网络服务器将重定向到的 URL。如果网络服务器必须进行重定向,则通过 GET(而不是 POST)获取真实页面,并且不会向您的脚本提供
signed_request
postdata。非常令人沮丧;我只花了一个半小时调试为什么我的测试应用程序可以工作而生产应用程序却不能。更糟糕的是,我知道这个答案,只是没有意识到这就是问题所在。很烦人!
Essentially, the problem is that your webserver is performing a redirect when it receives the request. In your case, it's redirecting from http://www.example.com/myfacebookapp/tab/ to http://www.example.com/myfacebookapp/tab/index.php; in my case it was redirecting from http://www.example.com/myfacebookapp/tab to http://www.example.com/myfacebookapp/tab/ (my app is built in .Net MVC, so has no filenames, but needs that trailing slash, apparently).
So the canonical solution is to make sure that the path in the Tab URL field is the actual URL, not one that the webserver will redirect to. If the webserver has to make a redirect, then the real page is fetched by GET (not POST) and no
signed_request
postdata is provided to your script.Very frustrating; I just spend an hour and a half debugging why my test app worked and the production one didn't. To make things worse, I knew this answer, it just didn't register that this was what the problem was. Very irritating!
谢谢赛斯,我也遇到了同样的问题。我可以在应用程序画布页面上获得签名请求,但不能在我的页面选项卡上获得签名请求。如需说明,
页面如果您的页面位于 www.foobar.com/facebook/tab/index.php 您需要输入“tab/index.php”(不带引号)而不仅仅是“tab/”
几天来一直在尝试解决这个问题!
Thanks Seth I was having the same problem. I could get a signed request on the app canvas page but not of my page tab. For clarification
ex. if your page is located at www.foobar.com/facebook/tab/index.php you need to put "tab/index.php" (without the quotes) rather than just "tab/"
Been trying to figure this out for days!
我找到了一个解决方案:
只需在选项卡 URL 末尾添加一个“/”即可。
例如:“http://domain.us/facebook/tab/”
它对我有用,请告诉我们它是否也适合您!
I found a solution:
Just put a "/" at the end of the tab url.
Like: "http://domain.us/facebook/tab/"
It worked for me, let us know if it also works for you!
使用应用程序进行身份验证后,您将获得signed_request数据,
按照以下网址进行身份验证
Once you are Authenticate with Application you will get the signed_request data,
Authenticated as like in the below URLs