且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取OAuth2访问令牌时出错:500错误

更新时间:2022-10-16 23:04:00

这可能是Google同步问题。查看此 Google网上论坛帖子,看看您是否有类似的问题。

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.

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