invalid_grant: Bad Request

1,095 views
Skip to first unread message

Analytics SP

unread,
Aug 6, 2021, 5:55:32 AM8/6/21
to AdWords API and Google Ads API Forum
I am not able to make API calls, I am getting this error: google.auth.exceptions.RefreshError: ('invalid_grant: Bad Request', {'error': 'invalid_grant', 'error_description': 'Bad Request'})

Although I am following exactly all the steps required: I generated a developer token with a basic access, I Set up authentication via OAuth2 and generated a client id and client secret, I generated a refresh token. I inserted the developer token, client id, client secret and refresh token in the googleads.yaml file, however, whenever I try to run the getcampaigns.py file to make my first api call, I am getting the above error: google.auth.exceptions.RefreshError: ('invalid_grant: Bad Request', {'error': 'invalid_grant', 'error_description': 'Bad Request'}) 

Google Ads API Forum Advisor

unread,
Aug 6, 2021, 12:17:34 PM8/6/21
to analytic...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to Google Ads API support. Refresh token support is a general GCP issue for many API's, you may reach out to GCP support for assistance.

With that being said you may want to try regenerating the refresh token. You may also check this page about refresh token expirations.

Regards,

Google Logo
Aryeh Baker
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Ll4yQ:ref

Analytics SP

unread,
Aug 8, 2021, 7:43:30 AM8/8/21
to AdWords API and Google Ads API Forum
Hello, Thank you for your reply. 
However, I tried regenerating a new refresh token but I also got the same error. I also tried regenerating a new client ID and client secret and then regenerating a new refresh token but it also didn't work. 

Google Ads API Forum Advisor

unread,
Aug 9, 2021, 10:27:41 PM8/9/21
to analytic...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for your follow up.

You mentioned that you already created a new set of credentials and refresh token and yet the issue persists. That said, could you confirm if :
  • You created your client ID and client secret by referring the steps mentioned here
  • The refresh token was created by following these steps for Python
If the above items have been followed and you are still encountering the issue, could you provide the complete request and response logs, and request-id? If you haven't yet, logging can be enabled by referring to this Python guide

You may then send the requested information via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Ll4yQ:ref
Reply all
Reply to author
Forward
0 new messages