0
votes

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

1 Answers

0
votes

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