Hello team,

Every couple of days, our scripts that make calls to the Google Ads API 
stop working because we're not able to obtain an access token. The request 
of getting an access token always comes back with the error: Invalid Grant 
- Bad Request.

We've been facing the same issue for some time now and we tried every 
relevant solution we can find online but nothing seems to be a permanent 
solution.

We're using the authorization flow as mentioned in the documentation of 
Google Ads API 
(https://github.com/googleads/google-ads-python/blob/HEAD/examples/authentication/authenticate_in_web_application.py),
 
obtaining the refresh token and then adding the refresh token along with 
our client id and secret to a json file. Then, we use the credentials json 
as follows in our python code to make API calls to Google Ads:

googleads_client = 
GoogleAdsClient.load_from_storage('google-ads-credentials.json', 
version='v9') # our code breaks here
ga_service = googleads_client.get_service('GoogleAdsService')
[...]
response = ga_service.search(customer_id=str(customer_id), query=query)

Also, we made sure that our Publishing Status is set to production mode in 
our 'OAuth Consent Screen' section of our Google Cloud Project.

Can you please advise on how we can keep the refresh token working so that 
our scripts can proceed with making API calls without any interruptions?

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords 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/479592c1-9c84-420e-a282-b20878affd7cn%40googlegroups.com.

Reply via email to