【问题标题】:Facebook status update: "Invalid OAuth access token"Facebook 状态更新:“无效的 OAuth 访问令牌”
【发布时间】:2012-01-20 13:13:54
【问题描述】:

帮助了解第三步(更新状态)失败的原因:

request_token(确定):

GET:https://graph.facebook.com/oauth/authorize?
client_id=XXX&
scope=offline_access,read_stream,publish_stream,user_activities,status_update&
redirect_uri=http%3A%2F%2Fexample.com

得到code

access_token(确定):

GET:https://graph.facebook.com/oauth/access_token?
client_id=XXX&
redirect_uri=http%3A%2F%2Fexample.com
client_secret=XXX&
code=XXX

得到access_token key 开始于AAA...

更新状态(错误):

POST:https://graph.facebook.com/me/feed/?access_token=XXX&message=Hello!

回复:

status:{"error":{"message":"Invalid OAuth access token.","type":"OAuthException"}}

可能是什么问题? 或者建议任何 C++ 库。

【问题讨论】:

  • 在获取 access_token 时,您传递的是相同的 request_token 和秘密?
  • @Umesh Awasthi,我正在发送 code,这是我从 request_token 收到的
  • 在重定向网址中,尝试在您的网址中添加或删除斜杠。我之前遇到过同样的问题,当我删除斜线时,它的工作原理。

标签: facebook facebook-graph-api oauth


【解决方案1】:

https://developers.facebook.com/tools/lint 上检查您的访问令牌并告诉我们它告诉您什么。

【讨论】:

  • 我不知道,linter 上还有比这更多的东西吗?尝试通过 Graph API Explorer 工具使用您的应用程序,以确保它在那里工作。
  • Graph API Explorer 向我展示了类似{ "id": "XXX", "name": "XXX", "first_name": "XXX", "last_name": "Guinness", "link": "XXX", "username": "XXX", "gender": "male", "locale": "en_US", "type": "user" }
  • 当我插入 access_token 时,Graph API Explorer 会显示一个带有选中选项的对话框:offline_access,read_stream,publish_stream,user_activities,status_update 所以我认为 access_token 是有效的。
猜你喜欢
  • 2021-01-13
  • 1970-01-01
  • 2019-04-28
  • 2012-06-22
  • 2018-09-24
  • 2015-04-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多