需要生成 OAuth 令牌才能打开对话框
我真的很挣扎于整个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 Facebook 对话框文档:
要求您提供 OAuth 访问令牌的原因是 Facebook 认为您正在尝试访问您的墙,该墙位于
https://graph.facebook.com/dustinmcgrew/feed
。身份验证中介绍了如何获取 OAuth 令牌(如果您正在构建 Facebook 应用程序,则需要了解该令牌)文档。 PHP SDK 还提供了一些方法(例如 getAccessToken )来简化此过程。
As per Facebook's Dialogs documentation:
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.