2013-06-21 23 views
2

我試圖創建一個新的集控制檯API密鑰,只接收這些錯誤:鏡API unauthorized_client

An error ocurred: Error refreshing the OAuth2 token, message: 
{ "error" : "unauthorized_client" } 

'An error ocurred: Error refreshing the OAuth2 token, message: 
'{ "error" : "unauthorized_client" }' 

更新:從錯誤的index.php從PHP SDK例子

 

Fatal error: Uncaught exception 'Google_AuthException' with message 'Error refreshing the OAuth2 token, message: '{ "error" : "unauthorized_client" }'' in google-api-php-client/src/auth/Google_OAuth2.php:280 Stack trace: #0 google-api-php-client/src/auth/Google_OAuth2.php(240): Google_OAuth2->refreshTokenRequest(Array) #1 google-api-php-client/src/auth/Google_OAuth2.php(217): Google_OAuth2->refreshToken('1/oS0qw-8UsYeFo...') #2 google-api-php-client/src/service/Google_ServiceResource.php(167): Google_OAuth2->sign(Object(Google_HttpRequest)) #3 google-api-php-client/src/contrib/Google_MirrorService.php(434): Google_ServiceResource->__call('list', Array) #4 index-demo.php(140): google_TimelineServiceResource->listTimeline(Array) #5 {main} thrown in google-api-php-client/src/auth/Google_OAuth2.php on line 280
+2

你能澄清一下這個問題嗎?您什麼時候收到這些錯誤信息,以及當時發生了什麼? – Prisoner

+0

這有很多潛在的原因。你能分享一下你用來提出請求的代碼嗎?您可能想要進行健全性檢查的一件事是,您可以通過https://developers.google.com/console – mimming

+0

的服務面板上的切換爲您的項目啓用Mirror API。對於該項目,絕對啓用了鏡像API ...在@Jenny Murphy的PHP快速入門中從index.php中刪除了一些錯誤github – ina

回答

1

最可能的原因是刷新令牌是由不同於用於刷新的客戶端ID /密鑰生成的。如果您在控制檯中更改爲新的API密鑰,則需要重新授權用戶。您無法刷新使用舊客戶端創建的令牌。