需要生成 OAuth 令牌才能打开对话框

发布于 2024-12-16 19:19:33 字数 768 浏览 2 评论 0原文

我真的很挣扎于整个 OAuth 的事情。我有一个链接,我想弹出一个对话框,将消息发布到用户的墙上。这是我的代码...

<a href="https://graph.facebook.com/dustinmcgrew/feed?
link=http://developers.facebook.com/docs/reference/dialogs/&
picture=http://fbrell.com/f8.jpg&
name=Facebook%20Dialogs&
caption=Reference%20Documentation&
description=Using%20Dialogs%20to%20interact%20with%20users.&
message=Facebook%20Dialogs%20are%20so%20easy!"><img src="images/share.gif" /></a>

当我单击链接时,它会生成此错误...

{
   "error": {
      "message": "An access token is required to request this resource.",
      "type": "OAuthException"
   }
}

我如何获取此访问令牌以及获取它后需要对它执行什么操作? Facebook 的文档真让我生气。它为您提供的示例代码仅完成了 IMO 所需任务的一半。

我正在使用 PHP SDK。

I am really struggling with this whole OAuth thing. I have a link that I want to pop open a dialog that will post a message to the user's wall. Here's my code...

<a href="https://graph.facebook.com/dustinmcgrew/feed?
link=http://developers.facebook.com/docs/reference/dialogs/&
picture=http://fbrell.com/f8.jpg&
name=Facebook%20Dialogs&
caption=Reference%20Documentation&
description=Using%20Dialogs%20to%20interact%20with%20users.&
message=Facebook%20Dialogs%20are%20so%20easy!"><img src="images/share.gif" /></a>

When I click the link it generates this error...

{
   "error": {
      "message": "An access token is required to request this resource.",
      "type": "OAuthException"
   }
}

How do I get this access token and is there anything I need to do with it after I get it? The Facebook documentation is really pissing me off. It gives you sample code that only does half of what it needs to do IMO.

I am using the PHP SDK.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

狠疯拽 2024-12-23 19:19:33

根据 Facebook 对话框文档

每个对话框都有一个方法名称和参数。对话框的 URL 始终以 http://www.facebook.com/dialog/ 开头,后跟对话框的名称和参数。

要求您提供 OAuth 访问令牌的原因是 Facebook 认为您正在尝试访问您的墙,该墙位于 https://graph.facebook.com/dustinmcgrew/feed

身份验证中介绍了如何获取 OAuth 令牌(如果您正在构建 Facebook 应用程序,则需要了解该令牌)文档。 PHP SDK 还提供了一些方法(例如 getAccessToken )来简化此过程。

As per Facebook's Dialogs documentation:

Every dialog has a method name and parameters. The URL to a dialog always starts with http://www.facebook.com/dialog/ followed by the name of the dialog and parameters.

The reason you are being asked for an OAuth access token is because Facebook thinks you are trying to access your wall, which is located at https://graph.facebook.com/dustinmcgrew/feed.

Getting an OAuth token (which you will need to understand if you are building a Facebook application) is covered in the Authentication documentation. The PHP SDK also provides methods (like getAccessToken to make this process easier.

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