RE: Google Ads API says “Token has been expired or revoked” despite using a refresh token For Desktop Application

2021-07-25 Thread Google Ads API Forum Advisor
Hi Karthik,

Thanks for reaching out to us. Kindly note that the invalid_grant usually 
indicates an issue with the refresh token. That said, you’ll need to regenerate 
credentials and refresh tokens. You may refer here to this guide for the steps 
on how you can regenerate credentials and refresh tokens.

Should you continue to encounter issues with the said token, even after 
following the steps from the above guide, I would recommend that you reach out 
instead to the Google API Console Support team via this link.

Regards,

Yasar
Google Ads API Team
ref:_00D1U1174p._5004Q2JD6Ro:ref

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/bQE2j0QWU6ST00Cn-N2F5iTWeMeBNt0Gw0cw%40sfdc.net.


Google Ads API says “Token has been expired or revoked” despite using a refresh token For Desktop Application

2021-07-23 Thread DHARAVATH KARTHIK
Hi all,



I've set up the whole Google Ads API according to this manual here: 
https://developers.google.com/google-ads/api/docs/client-libs/python/oauth-desktop?hl=en

I got my refresh token and put it in my google-ads.yaml file which looks 
exactly like this: 
https://github.com/googleads/google-ads-python/blob/master/google-ads.yaml. 
I also put my client_id, developer_token and client_secret at the 
corresponding spots in the file.

Everything worked out and I tried an example to  get forecast metrics of 
few keywords campaigns: 
https://developers.google.com/google-ads/api/docs/keyword-planning/generate-forecast-metrics
 
.
 
Also I could use other services of the API.

Each time I use the API I access it via the client using the following code:
from google.ads.google_ads.client import GoogleAdsClient 
client = GoogleAdsClient.load_from_storage(path_to_google_ads_yaml_file)

As I already said it worked.

A few days later I tried to connect again and I got the following error:

google.auth.exceptions.RefreshError: ('invalid_grant: Bad Request', 
{'error': 'invalid_grant', 'error_description': 'Bad Request'})

So I did the process of getting a new refresh token again (
https://developers.google.com/google-ads/api/docs/client-libs/python/oauth-desktop?hl=en)
 
such that everything worked out again.

One day later I got the same error again.  Please someone suggest me the 
reason for this error.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/ff5a43d0-71d5-4231-a8e9-5636333bf70bn%40googlegroups.com.