简体   繁体   English

未捕获OAuthException:Facebook PHP API出现未知错误

[英]Uncaught OAuthException: An unknown error has occurred with Facebook PHP API

I have this small script that gets the albums from a page. 我有这个小脚本从页面获取专辑。 This was working fine until today I started getting this wierd error: 这工作正常,直到今天我开始得到这个奇怪的错误:

Uncaught OAuthException: An unknown error has occurred.\\n thrown in .../base_facebook.php on line 1254 未捕获OAuthException:发生了未知错误。\\ n在第1254行的... / base_facebook.php中抛出\\ n

I checked other questions related to this and everyone seems to have this for different reasons. 我检查了与此相关的其他问题,每个人似乎都有这个原因。 This was working fine for months and I never touched it. 这几个月工作正常,我从来没有碰过它。 I also checked the App ID and Secret in case they expired or something, but the ones on the Facebook App page are still the same. 我还检查了App ID和Secret,以防它们过期或者其他什么,但Facebook App页面上的那些仍然是相同的。

What could have happened to suddenly cause this? 什么可能突然导致这种情况?

I did some more debugging and the problem is occurring in the _graph() function getting this result from Facebook: 我做了一些调试,问题出现在_graph()函数中,从Facebook获得这个结果:

[13-Mar-2014 01:22:46 UTC] array (
  'error' => 
  array (
    'message' => 'An unknown error has occurred.',
    'type' => 'OAuthException',
    'code' => 1,
  ),
)

I checked the Facebook developer site here: https://developers.facebook.com/docs/graph-api/using-graph-api/#errors and Error code 1 is just described as: 我在这里检查了Facebook开发者网站: https//developers.facebook.com/docs/graph-api/using-graph-api/#errors ,错误代码1被描述为:

Possibly a temporary issue due to downtime - retry the operation after waiting, if it occurs again, check you are requesting an existing API. 可能是因停机而导致的临时问题 - 等待后重试操作,如果再次发生,请检查您是否正在请求现有API。

I've been having the problem all day long though! 我整天都遇到了这个问题! I don't think it is a temporary issue. 我不认为这是一个暂时的问题。

Finally managed to find where the issue was coming from. 最后设法找到问题的来源。 For some reason I was getting albums which had a null cover photo (still no idea from where this came from, there are no visible albums without a cover photo on the facebook page!), and since I was querying the album's cover photo URL one of the queries in the batch request had a NULL relative_url . 出于某种原因,我得到的专辑有一张null封面照片(仍然不知道它来自哪里,没有可见的专辑没有Facebook页面上的封面照片!),因为我查询了专辑的封面照片网址批处理请求中的查询具有NULL relative_url

Typical of Facebook, instead of replying with a proper error like 'invalid relative URL' or something that helps you debug the problem, they just replied with an OAuthException with error code 1 to the whole batch request, throwing you off course what the real problem is. 典型的Facebook,而不是回复正确的错误,如'无效的相对URL'或帮助您调试问题的东西,他们只是回复了一个OAuthException错误代码1到整个批处理请求,让你偏离真正的问题是什么是。

Adding a simple null check fixed the problem... if only the error was a bit more indicative of the real problem! 添加一个简单的空值检查修复了问题...如果只有错误更能说明真正的问题! Hope this helps someone else... 希望这有助于其他人......

暂无
暂无

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

相关问题 Facebook-创建事件给出“未捕获的OAuthException:发生未知错误” - Facebook - Creating event gives “Uncaught OAuthException: An unknown error has occurred” Facebook PHP API出现未捕获的OAuthException错误 - Uncaught OAuthException Error with Facebook PHP api 上手OAuthException:将照片发布到目标相册后发生未知错误 - Getting Uncaught OAuthException: An unknown error has occurred on photo post to target album 未捕获的异常:1:在Facebook API中引发了未知错误,FQL错误 - Uncaught exception: 1: An unknown error occurred thrown in Facebook API, FQL error Facebook API未捕获的OAuthException:(#200) - Facebook API Uncaught OAuthException: (#200) 未捕获的OAuthException:(#200)Facebook PHP - Uncaught OAuthException: (#200) Facebook PHP Facebook API错误致命错误:(未捕获的OAuthException:验证应用程序时出错) - Error with Facebook API Fatal error: (Uncaught OAuthException: Error validating application) 致命错误:未捕获的OAuthException:发生意外错误。 请稍后重试您的请求 - Fatal error: Uncaught OAuthException: An unexpected error has occurred. Please retry your request later Facebook应用致命错误:未捕获的OAuthException: - Facebook App Fatal error: Uncaught OAuthException: Facebook 营销 Api - 在循环上运行抛出“AuthorizationException 发生未知错误”。 (第二次) - Facebook Marketing Api - running on loop throws “AuthorizationException An unknown error has occurred.” (on 2nd time)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM