Google API Error 401 invalid authentication credentials

女生的网名这么多〃 提交于 2019-12-25 10:47:50

问题


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?


回答1:


[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.



来源:https://stackoverflow.com/questions/45275526/google-api-error-401-invalid-authentication-credentials

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