Im trying to create a script for fetching specific emails send in my gmail 
account.
I created the project at google cloud platform, i followed the instructions 
from this yt video: https://www.youtube.com/watch?v=j_ilbyXwIzI and it 
worked. After two or three months back i wanted to try it again because i 
left it as a side project for a while and it didn't worked.
It throws this error:

PHP Fatal error:  Uncaught Google\Service\Exception: {
  "error": "invalid_grant",
  "error_description": "Bad Request"
} in /root/vendor/google/apiclient/src/Http/REST.php:128
Stack trace:
#0 /root/vendor/google/apiclient/src/Http/REST.php(103): 
Google\Http\REST::decodeHttpResponse()
#1 [internal function]: Google\Http\REST::doExecute()
#2 /root/vendor/google/apiclient/src/Task/Runner.php(182): 
call_user_func_array()
#3 /root/vendor/google/apiclient/src/Http/REST.php(66): 
Google\Task\Runner->run()
#4 /root/vendor/google/apiclient/src/Client.php(898): 
Google\Http\REST::execute()
#5 /root/vendor/google/apiclient/src/Service/Resource.php(238): 
Google\Client->execute()
#6 
/root/vendor/google/apiclient-services/src/Google/Service/Gmail/Resource/UsersMessages.php(168):
 
Google\Service\Resource->call()
#7 /root/quickstart.php(72): 
Google_Service_Gmail_Resource_UsersMessages->listUsersMessages()
#8 {main}
  thrown in /root/vendor/google/apiclient/src/Http/REST.php on line 128

After reading in the documentation and google posts but without finding the 
answer, I created a new OAuth2.0 Client ID with new credentials.json and 
configured it for a new web server and with exactly the same script it 
worked as before.

Now my question is, what made the code not work anymore at the previous 
environment/web server? The token or something else was expired. What 
should I do to prevent from happening this issue again?

*Thanks in advance!!*

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/5235b630-a232-4eb8-950a-d3a5ab736158n%40googlegroups.com.

Reply via email to