简体   繁体   English

Facebook 图 API 给出未知的 OAuthException

[英]Facebook Graph API giving an unknown OAuthException

When I send a request to https://graph.facebook.com/me/home?access_token= (access code goes here) Facebook gives me this error message:当我向https://graph.facebook.com/me/home?access_token=发送请求时(访问代码在此处) Facebook 给了我这个错误消息:

{
   "error": {
      "type": "OAuthException",
      "message": "An unknown error has occurred."
   }
}

Every other API call works.每隔一个 API 调用都有效。 If anybody knows anything about this issue, please help me.如果有人对此问题有所了解,请帮助我。

Facebook does not have very good error messages... Facebook 没有很好的错误信息...

Apparantly, "An unknown error has occurred" means that I did not have valid permissions to access the user's news feed.显然,“发生了未知错误”意味着我没有访问用户新闻提要的有效权限。

You have to include "read_stream" in your scope, or else facebook will reject your request with an ambiguous error message.您必须在 scope 中包含“read_stream”,否则 facebook 将拒绝您的请求,并显示一条模棱两可的错误消息。

I <3 you facebook API我<3你facebook API

In addition to the other answers provided here...除了此处提供的其他答案...

In our production app (working with thousands of access tokens for several years), it appears that we occasionally get this error due to a temporary glitch in the API.在我们的生产应用程序中(使用数千个访问令牌数年),由于 API 中的临时故障,我们似乎偶尔会收到此错误。 I'm still not sure what the root cause is, but simply retrying the API call a few minutes later seems to consistently resolve the issue for us.我仍然不确定根本原因是什么,但只需在几分钟后重试 API 调用似乎始终可以为我们解决问题。

I get this error when the access token is the application's token.当访问令牌是应用程序的令牌时,我收到此错误。 With the user-specific token, the api calls succeed.使用特定于用户的令牌,api 调用成功。

Before the oauth upgrade, the application's token worked.在 oauth 升级之前,应用程序的令牌有效。 The user-specific token worked and usually returned even more data.特定于用户的令牌有效并且通常返回更多数据。

Of course with facebook there's no way of knowing whether the current behavior (fails when using application token) is a bug or just the new way.当然,对于 facebook,无法知道当前行为(使用应用程序令牌时失败)是错误还是只是新方式。

According to http://developers.facebook.com/docs/reference/api/ , the parameter is access_token , not access .根据http://developers.facebook.com/docs/reference/api/ ,参数是access_token ,不是access

I had this same issue and fixed it.我遇到了同样的问题并修复了它。 For me, I was passing a single JSON object in the "batch" field, but Facebook wanted a JSON array.对我来说,我在“批处理”字段中传递了一个 JSON object ,但 Facebook 想要一个 Z0ECD11DZ4823BBD72A 数组。

For example, this will work, because it has a JSON array denoted by square brackets:例如,这将起作用,因为它有一个用方括号表示的 JSON 数组:

POST /v2.11 HTTP/1.1
Host: graph.facebook.com
Content-Type: application/json
Cache-Control: no-cache
{
"access_token":"YOUR_ACCESS_TOKEN",
"batch":[{"method":"GET", "relative_url":"me/friends?limit=50"}]
}

This will not, because there is no JSON array denoted by square brackets:这不会,因为没有用方括号表示的 JSON 数组:

POST /v2.11 HTTP/1.1
Host: graph.facebook.com
Content-Type: application/json
Cache-Control: no-cache
{
"access_token":"YOUR_ACCESS_TOKEN",
"batch":{"method":"GET", "relative_url":"me/friends?limit=50"}
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Facebook Graph API评论提到了thorws OAuthException - Facebook Graph API commenting on mentions thorws OAuthException Facebook Graph API:发布链接-OAuthException - Facebook Graph API: Publishing a link - OAuthException Facebook Graph Api OAuthException,但访问令牌有效 - Facebook Graph Api OAuthException but access token is valid 未捕获OAuthException:Facebook PHP API出现未知错误 - Uncaught OAuthException: An unknown error has occurred with Facebook PHP API 使用facebook图表api发布时出现OAuthException 2500错误 - Error OAuthException 2500 while posting with facebook graph api 不活动后,Facebook API OAuthException - Facebook API OAuthException after inactivity Facebook API未捕获的OAuthException:(#200) - Facebook API Uncaught OAuthException: (#200) 通过Graph API评论文章时出现“ OAuthException-发生未知错误” - “OAuthException - An unknown error has occurred” when commenting articles through the Graph API 使用Facebook Open Graph发布故事时出现OAuthException - OAuthException when posting story with Facebook Open Graph Facebook graph-API OAuthException代码:368太快使用此功能 - Facebook graph-API OAuthException Code:368 Misusing this feature by going too fast
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM