在画布页面应用程序 php-sdk 中链接到新页面的正确方法
我遇到了几个问题,想知道是否有人有任何见解。我正在使用最新的 php-sdk 我正在开发一个画布应用程序,它有许多不同的步骤。这些步骤分布在多个页面上。现在,当我第一次进入应用程序时,一切似乎都工作正常。访问令牌就在那里,我可以调用 api 函数。在第二页(链接到同一 iframe 中)上,我收到 OAuth 错误。现在,如果我在第二页上使用它:
$me = $facebook->getUser();
var_dump($me);
它会返回正确的用户 ID,但在尝试使用 api 查询(特别是本例中的 FQL 查询)时我仍然遇到错误
现在,请记住这些链接位于 iframe 内,因此我假设signed_request在某个地方丢失了,我知道facebook通常通过POST发出这个问题。如果我将所有链接设置为 target="_parent",其网址例如 http://apps. facebook.com/myapp/page2.php 然后一切正常。 Facebook 这次显然发布了正确的信息。随后,当我使用仅重定向 iframe 的链接时,它似乎再次正常工作(暗示在某处设置了 cookie)。
现在我看到其他没有 target="_parent" 的应用程序似乎可以正常工作,只在后续点击时加载 iframe,而不是完整的 facebook 网站。所以我只能假设他们将这些信息存储在某个地方。我尝试使用 httpfox 检查这些应用程序,但看不到任何明显的东西。有人有关于多页面应用程序最佳实践的链接吗?我知道我可以使用完整的网址和 target="_blank" 来解决这个问题,但我想知道这里发生了什么。我已经浏览了开发人员文档和画布页面示例,但对我来说没有什么明显的。
任何帮助或信息将不胜感激
非常感谢
I'm running in to a couple of issues and wondered if anyone had any insight. I'm using the latest php-sdk I'm developing a canvas app that has a number of different steps. These steps are spread across multiple pages. Now when I first enter the app everything seems to work fine. The access token is there and I can call the api functions. On the second page (which is linked to in the same iframe) I get OAuth errors. Now if I use this on the 2nd page:
$me = $facebook->getUser();
var_dump($me);
it returns the correct user id, but I still get errors when trying to use an api query (specifically a FQL one in this instance)
Now, bear in mind these links are within the iframe so I was assuming the signed_request is getting lost somewhere, I know facebook normally issues this via a POST. If I set all my links to target="_parent" with a url such as http://apps.facebook.com/myapp/page2.php then everything works fine. Facebook clearly posts the correct info this time. Subsequently, then when I use links that only redirect the iframe it seems to work fine again (implying a cookie is being set somewhere).
Now I've seen other apps that don't have a target="_parent" that seem to work correctly, only ever loading the iframe on subsequent clicks and not the full facebook site. So I can only assume they are storing this info somewhere. I've tried to inspect these apps using httpfox but I can't see anything obvious. Does anyone have any links for best practice with multiple page apps? I know I can get around this using full urls and target="_blank" but I would like to know what's going on here. I've looked through the developer docs and the canvas page examples, but there's nothing obvious to me.
Any help or info would be appreciated
Many Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一些方法可以
signed_request
来实现此目的There is some ways to achieve this
signed_request
from initial page loaded in canvas