Google API错误401无效的身份验证凭据 [英] Google API Error 401 invalid authentication credentials
问题描述
我正在与Google的API合作。一切正常,突然它显示这个错误:
$ b
致命错误:Uncaught Google_Service_Exception:{error:{code:401 ,message:请求具有无效的认证凭证,期望的OAuth 2访问令牌,登录cookie或其他有效的认证凭证。为了解决这个问题,我不得不创建新的证书,但事情是经常再次出现错误,这是一种烦人的,因为我必须重新启动计算机等等。
编辑
现在我把所有东西放在服务器上我使用google验证了域名,我更改了凭据,之前我使用的是OAuth 2.0客户端ID
,现在我正在使用API密钥,一切工作都很好,现在我有同样的错误。
有什么想法?
>
这是一堆o (oauth2callback.php和API Credentials)。
以及我必须捕获错误401并将其发送到文件oauth2callback.php。这会生成一个新的令牌并将您发送到主页。
I'm working with API of Google. Everything was working fine when suddenly it displays this error:
Fatal error: Uncaught Google_Service_Exception: { "error": { "code": 401, "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential.
In order to sort this out I had to create new credential but the thing is the error come again often and it is a kind of annoying as I have to reboot the computer,etc..
Anyone know how can i fix this?
EDITING
Now I put everything in a server with a domain .com. I verified the domain with google. I changed the credentials. I was using before OAuth 2.0 client IDs . Now I am using API keys. Everything was working fine for hours. Now I have the same error.
Any idea?
解决方案[solved]
it was a bunch o problem, overall in the configuration (oauth2callback.php and API Credentials).
As well i had to catch the error 401 and send it to the file oauth2callback.php. This generate a new token and send you to the homepage.
这篇关于Google API错误401无效的身份验证凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!