Facebook iframe 选项卡签名请求始终为空

发布于 2024-10-21 01:05:49 字数 508 浏览 2 评论 0原文

我正在开发 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

彻夜缠绵 2024-10-28 01:05:49

好吧,想通了!
配置应用程序时,我将“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!

回眸一遍 2024-10-28 01:05:49

本质上,问题在于您的网络服务器在收到请求时正在执行重定向。在您的情况下,它从 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!

孤凫 2024-10-28 01:05:49

谢谢赛斯,我也遇到了同样的问题。我可以在应用程序画布页面上获得签名请求,但不能在我的页面选项卡上获得签名请求。如需说明,

  1. 请访问 www.facebook.com/developers/
  2. 单击应用程序的编辑设置
  3. 单击
  4. “页面选项卡”部分底部的“Facebook 集成”选项卡 在选项卡 URL 字段中输入您的 facebook 的 index.php 页面的路径登陆

页面如果您的页面位于 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

  1. go to www.facebook.com/developers/
  2. click on edit settings for your app
  3. click the Facebook Integration tab
  4. at the bottom in the Page Tabs section in the Tab URL field enter in the path to the index.php page for your facebook landing page

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!

最美不过初阳 2024-10-28 01:05:49

我找到了一个解决方案:
只需在选项卡 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!

转身以后 2024-10-28 01:05:49

使用应用程序进行身份验证后,您将获得signed_request数据,
按照以下网址进行身份验证

Once you are Authenticate with Application you will get the signed_request data,
Authenticated as like in the below URLs

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文