为什么发布到 facebook 页面会产生“用户尚未授权该应用程序"? [英] why does posting to facebook page yield "user hasn't authorized the application"

查看:16
本文介绍了为什么发布到 facebook 页面会产生“用户尚未授权该应用程序"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了 fb 文档并编写了将消息发布到 Facebook页面"的代码,但是我收到了一个我不希望看到的错误:

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

这是我所做的:

  • 我设置了一个 facebook 应用程序,它提供了我的 APP_IDAPP_SECRET.
  • 我设置了一个测试 Facebook页面".让我们将其 fb id 称为 PAGE_ID.
  • 使用 OAuth 为用户获取范围为publish_actions,manage_pages"的 USER_ACCESS_TOKEN.重定向到 Facebook 身份验证页面时,我接受了我的应用请求的权限.
  • 我使用 USER_ACCESS_TOKENhttps://graph.facebook.com/me/accounts 上做了一个 GET,然后我得到了我管理的页面列表,包括我想发帖的那个.
  • I set up a facebook application, which provides my APP_ID and APP_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 the USER_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"
      ]
    }, 
    ....
  ]
}

然后我使用PAGE_ACCESS_TOKEN向页面发布消息:

Then I use the PAGE_ACCESS_TOKEN to post a message to the page:

  • 我在 https://graph.facebook.com/PAGE_ID/feed 上发布了一个 POST,其字段 message 等于 这是一个测试帖子.
  • I did a POST on https://graph.facebook.com/PAGE_ID/feed with a field message equal to This is a test post.

Facebook 回归:

Facebook returns:

{
  "error": {
    "message": "(#200) The user hasn't authorized the application to perform this action", 
    "type": "OAuthException", 
    "code": 200
  }
}

使用令牌调试器,我可以确认我的PAGE_ACCESS_TOKEN 有效,并且具有范围:manage_pagespublish_actions.

Using the token debugger, I can confirm that my PAGE_ACCESS_TOKEN is valid, and has scopes: manage_pages and publish_actions.

我在哪里缺少授权应用程序?我需要额外的范围吗?我错过了点击 facebook 授权屏幕上的东西吗?我缺少的应用程序上是否有设置?经过几天的调试,我一定对这个问题视而不见.:-|

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 不再使用.要在页面上发布,我必须同时使用 manage_pagespublish_pages.

status_update is not used anymore. To publish on pages, I had to use both manage_pages and publish_pages.

这篇关于为什么发布到 facebook 页面会产生“用户尚未授权该应用程序"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆