facebook - 如何获得一个 Facebook 访问 token ,该 token 具有足够的权限来获取标记您的帖子?

标签 facebook facebook-graph-api oauth-2.0 facebook-wall facebook-access-token

使用 @Name 标记您的 Facebook 帖子会出现在您的信息墙上。


我的一个 friend 发布了一个链接并在其中标记了我:

The startup Guide


关于Graph API documentation ,当我点击我的动态消息链接(Ctrl + F: Profile feed)时,我可以看到这篇文章:

  ...
  {
     "id": "XXX",
     "from": {
        "name": "XXX",
        "id": "XXX"
     },
     "to": {
        "data": [
           {
              "name": "XXX",
              "id": "XXX"
           },
           {
              "name": "Christophe Maillard",
              "id": "XXX"
           }
        ]
     },
     "message": "The startup Guide (cc XXX, Christophe Maillard)",
     "link": "http://mashable.com/2012/06/27/startup-guide-1000-users/",
     "name": "How to Get to Your First 1,000 Users",
     "caption": "mashable.com",
     "description": "With the help of some smart marketers and entrepreneurs, we're created a clear outline for attracting your startup's first 1,000 users.",
     ...
  }
  ...

此提要的网址是 https://graph.facebook.com/me/feed?access_token=XXX


当复制/粘贴给定的访问 token 时 - 在上面的 URL 中被 XXX 替换的 token - 在 debugger 中,我得到这样的东西:

Access Token Debugger

正如我们所见,访问 token 是由应用 Test_console 生成的,它使用了相当多的作用域。


然后,我转到 Graph API Explorer ,我使用 Get Access Token 按钮生成一个访问 token ,并指定调试器给我的所有范围,即 Test_console 应用程序用于生成其 working 访问 token 。最后,我通过提交 GET 请求访问 URL me/feed。问题:我在浏览器中看不到标记了我的相关帖子

我也有自己的应用程序,它的 react 与 Graph API Explorer 完全一样: 我也无法使用 Graph API 在我的信息墙上找到该帖子。

显然,可以使用 Graph API 获取标记了您的帖子,因为 Test_console 应用能够生成适当的访问 token 。但是我怎样才能为我自己的应用获取这样的访问 token ?

最佳答案

您需要为您的应用授予适当的权限。在 graph api explorer https://developers.facebook.com/tools/explorer?method=GET&path=me在应用程序字段(右上角)切换到您的应用程序,以查看当前授予您的应用程序的权限(通过再次单击“获取访问 token ”按钮)。然后确保你添加了正确的(我想你要的是 read_stream)https://developers.facebook.com/docs/authentication/permissions/

关于facebook - 如何获得一个 Facebook 访问 token ,该 token 具有足够的权限来获取标记您的帖子?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11311488/

相关文章:

facebook - 用于处理本地和社交身份验证提供程序的Mongoose用户模型

facebook - 尽管 OpenGraph 响应良好,但为什么发布到 Facebook 的应用程序帖子不显示为通过我的应用程序粘贴的?

facebook - Golang Facebook Graph API 应用引擎

events - 图形 API - 按所有者/创建者获取事件

c# - 添加MicrosoftIdentityWebAppAuthentication 刷新 token

ios - FBSDKLoginManager 未在 native ios 应用程序中打开登录对话框

ios - iOS 上的 POST 请求 - 不起作用

node.js - 如果一切都是客户端,如何通过 OAuth 安全地验证 React 客户端?

c# - 使用 Salesforce 的 MVC OAuth 身份验证返回登录页面

c++ - 最完整的 c++ facebook 库