为什么发布到Facebook页面收益“用户没有授权应用程序” [英] why does posting to facebook page yield "user hasn't authorized the application"
问题描述
我已经阅读了fb文档和书面代码,将消息发布到Facebook的页面,但是我收到一个错误,我不期待看到:
(#200)用户尚未授权应用程序执行此操作
以下是我所做的:
- 我设置了一个Facebook应用程序,它提供了我的
APP_ID
和
APP_SECRET
。 - 我设置了一个测试Facebook页面 。让我们将其fb id称为
PAGE_ID
。 - 使用OAuth获取
USER_ACCESS_TOKEN
与范围publish_actions,manage_pages为用户。我接受了我的应用程序在重定向到facebook auth页面时所要求的权限。 - 我在
https://graph.facebook.com/me/上做了一个GET帐户
使用USER_ACCESS_TOKEN
,然后我收到我管理的页面列表,包括我要发布的页面。
我的页面的这个数据块看起来像:
{
data:[
{
category:Community,
name:我的通用测试页,
access_token :PAGE_ACCESS_TOKEN,
id:PAGE_ID,
perms:[
ADMINISTER,
EDIT_PROFILE,
CREATE_CONTENT,
MODERATE_CONTENT,
CREATE_ADS,
BASIC_ADMIN
]
},
....
]
}
然后我使用 PAGE_ACCESS_TOKEN
发布消息到页面:
- 我在
https://graph.facebook.com/PAGE_ID/feed
与一个字段消息
等于这是一个测试帖子。
Facebook返回:
{
error:{
message:(#200)用户尚未授权应用程序执行此操作,
type:OAuthException,
code:200
}
}
使用令牌调试器,我可以确认我的 PAGE_ACCESS_TOKEN
有效,并具有范围: manage_pages
和 publish_actions
。 p>
我在哪里遗漏了授权应用程序?我需要额外的范围吗?我错过了点击Facebook授权屏幕上的某些内容吗?在我失踪的应用程序中有一个设置吗?经过几天的调试,我一定是对这个问题无视。 : - |
status_update
不再使用了。要在页面上发布,我必须同时使用 manage_pages
和 publish_pages
。
I have read the fb docs and written code to publish a message to a facebook "page", however I am getting an error that I don't expect to see:
(#200) The user hasn't authorized the application to perform this action
Here's what I've done:
- I set up a facebook application, which provides my
APP_ID
andAPP_SECRET
. - I set up a test facebook "page". Let us refer to its fb id as
PAGE_ID
. - Used OAuth to get a
USER_ACCESS_TOKEN
with scope "publish_actions,manage_pages" for the user. I accepted the permissions requested by my app when redirected to the facebook auth page. - I did a GET on
https://graph.facebook.com/me/accounts
using theUSER_ACCESS_TOKEN
, and I get back a list of pages I administrate, including the one I want to post to.
This block of data for my page looks like:
{
"data": [
{
"category": "Community",
"name": "My Generic Test Page",
"access_token": PAGE_ACCESS_TOKEN,
"id": PAGE_ID,
"perms": [
"ADMINISTER",
"EDIT_PROFILE",
"CREATE_CONTENT",
"MODERATE_CONTENT",
"CREATE_ADS",
"BASIC_ADMIN"
]
},
....
]
}
Then I use the PAGE_ACCESS_TOKEN
to post a message to the page:
- I did a POST on
https://graph.facebook.com/PAGE_ID/feed
with a fieldmessage
equal toThis is a test post.
Facebook returns:
{
"error": {
"message": "(#200) The user hasn't authorized the application to perform this action",
"type": "OAuthException",
"code": 200
}
}
Using the token debugger, I can confirm that my PAGE_ACCESS_TOKEN
is valid, and has scopes: manage_pages
and publish_actions
.
Where am I missing authorizing the application? Do I need additional scopes? Did I miss clicking something on the facebook authorization screen? Is there a setting on the app I am missing? After days of debugging this, I must be blind to the problem. :-|
status_update
is not used anymore. To publish on pages, I had to use both manage_pages
and publish_pages
.
这篇关于为什么发布到Facebook页面收益“用户没有授权应用程序”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!