Error fetching OAuth2 access token : 500 Error

江枫思渺然 提交于 2019-12-07 12:35:19

问题


I am being randomly bugged by the following error message:
This occurs when php library tries to obtain the access token line 112.

Sometimes my code obtains access token in first try, sometimes I need to refresh the URL containing 'code' as get parameter multiple times before access token is obtained.

This error is coming frequently for last 3-4 days.

Fatal error: 
Uncaught exception 'apiAuthException' with message 'Error fetching OAuth2 access token, message: 
'<HTML> <HEAD> <TITLE>Error processing OAuth 2 request</TITLE> </HEAD> 
<BODY BGCOLOR="#FFFFFF" TEXT="#000000"> 
<H1>Error processing OAuth 2 request</H1> 
<H2>Error 500</H2> 
</BODY> </HTML> 
'' in /google-api-php-client-0.5.0/google-api-php-client/src/auth/apiOAuth2.php:105
 Stack trace: #0 /google-api-php-client-0.5.0/google-api-php-client/src/apiClient.php(138): apiOAuth2->authenticate(Array) 
#1 l.php(191): apiClient->authenticate() 
#2 l.php(99): googoauthinit(true) 
#3 {main} thrown in /google-api-php-client-0.5.0/google-api-php-client/src/auth/apiOAuth2.php on line 105

The code I use is directly lifted from here (EXACTLY same code with all parameters like app name, secret key, id etc correctly filled). Also, tried registering new app but same error is received.


回答1:


It might be a Google synchronization issue. Check out this Google Groups post and see if you have a similar issue.




回答2:


I believe this issue is similar to this question on SO. You'll find the solution in the comments of the answer.

To disable at run time, you can use $this->client->setClassConfig("Google_Http_Request", "disable_gzip", true) as well.

This worked great for me.



来源:https://stackoverflow.com/questions/11495303/error-fetching-oauth2-access-token-500-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!