Error fetching OAuth2 access token : 500 Error

2019-05-11 10:44发布

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.

2条回答
对你真心纯属浪费
2楼-- · 2019-05-11 10:56

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.

查看更多
【Aperson】
3楼-- · 2019-05-11 11:13

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

查看更多
登录 后发表回答