Facebook API:如何发布到页面墙
这与此处的情况相同,但现在我需要向 Facebook 主页 的墙上发布消息。
我尝试了以下操作(其他代码与答案中的相同):
$facebook->api('/PAGE-ID/feed', 'post', $attachment)
但我收到错误
(#200) 用户尚未授权应用程序执行此操作。
我认为该操作的 access_token
是错误的,但是在哪里/如何获得正确的?
It's the same situation as here, but now I need to post a message to the wall of a Facebook Page.
I tried the following (the other code is the same as in the answer):
$facebook->api('/PAGE-ID/feed', 'post', $attachment)
But I get the error
(#200) The user hasn't authorized the application to perform this action`.
I think I have the wrong access_token
for that action but where/how do I get the correct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Facebook 有关获取 access_tokens 和权限的文档记录在其网站此处上。
如果您想离线发布,您将需要获取一个永久 access_token,该令牌具有向用户状态页面发布的权限。您必须拥有永久(或离线访问)令牌才能执行此操作而不必担心令牌过期。
请求 access_token 时,您可以向发出的 GET 请求添加附加权限属性,在该密钥中指定所需的附加权限。
编辑:
获取具有范围权限的令牌的过程位于此处,位于“授权”部分下看第二个例子。它将有一个请求额外权限的“范围”示例。权限曾经记录在 OAuth 流程中,但抱歉,它们似乎已发生变化。
Facebooks documentation on obtaining access_tokens and permissions is documented on their site Here.
You will need to obtain a permanent access_token with the permissions to post to the users status page if you want to post offline. You must have the permanent (or offline_access) token in order to do this without worrying about the token expiring.
When requesting an access_token you can add an additional permissions attribute to the GET request that is issued, in that key you specify the additional permissions you would like.
EDIT:
The process for obtaining a token with scope permission is here, under the section "Authorization" look at the second example. It will have a "scope" sample requesting additional permissions. The permissions used to be documented in the OAuth flow, but they seem to have moved, sorry.
该错误消息听起来更像是您有访问令牌,但权限是错误的。阅读扩展权限
您可能需要在用户登录时请求“publish_stream”在/授予您的“应用程序”权限。
That error message sounds more like you have an access token, but the permissions are wrong. Read up on extended permissions
You probably need to ask for "publish_stream" when your user logs in/gives permissions on your "app".