Google Adwords/Ads API Invalid_grant error Bad Request

1,489 views
Skip to first unread message

pratik patel

unread,
Aug 5, 2021, 8:49:26 AM8/5/21
to AdWords API and Google Ads API Forum
Hi,

If we generate new access token and refresh token and after that it will work all requests using google ads api/ adwords api. 

But after some days if we going to try same call giving error 

'Client error: `POST https://www.googleapis.com/oauth2/v4/token` resulted in a `400 Bad Request` response:
{
  "error": "invalid_grant",
  "error_description": "Bad Request"
}

We get access type is offline so we not want to generate refresh token again and again.

Regards,
Pratik Patel

Google Ads API Forum Advisor

unread,
Aug 5, 2021, 1:22:22 PM8/5/21
to anay....@gmail.com, adwor...@googlegroups.com
Hello,

Thanks for reaching out. Can you please try regenerating your OAuth2 credentials along with the refresh token and see is this behavior persists?

Please let us know if you continue to see this issue.

Regards,
Matt
Google Ads API Team

Google Logo
Matt
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Lkmcl:ref

Ramesh Pun

unread,
Aug 6, 2021, 10:00:04 AM8/6/21
to AdWords API and Google Ads API Forum
Hi

I'm receiving similar kind of error to the queries above by @anay. This is my third time that I've regenerated my OAuth2 credentials.
I see the following errors:
GuzzleHttp\Exception\ClientException: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:
{
  "error": "invalid_grant",
  "error_description": "Token has been expired or revoked."
}

Thanks,
Ramesh

Google Ads API Forum Advisor

unread,
Aug 9, 2021, 4:07:17 PM8/9/21
to rames...@minstersoft.co.uk, adwor...@googlegroups.com
Hi Ramesh,

Can you please reply privately with the complete request and response logs so that we can have a closer look? Also, can you please confirm that you have enabled the Ads API in your Console project?

Thanks,

Ramesh Pun

unread,
Aug 11, 2021, 5:37:06 AM8/11/21
to AdWords API and Google Ads API Forum
Hi,

Thank you for the response. I've created new OAut2 credentials with publishing status of 'In Production' and it's working fine till now.

I think, the problem might have occurred in first place because previously OAuth2 Credentials might have been created when publishing status was 'In Testing' which expires in 7 days.

If problem persists in future, I'll contact you privately. BTW: How do I contact you privately?

Thanks,
Ramesh

Google Ads API Forum Advisor

unread,
Aug 11, 2021, 10:42:08 AM8/11/21
to rames...@minstersoft.co.uk, adwor...@googlegroups.com
Hi Ramesh,

This is Lakshmi from Google Ads API team. I work along with Matt. Glad to hear that your issue was resolved. Yes in testing phase, the refresh token will expire in 7 days. OAuth guide: https://developers.google.com/identity/protocols/oauth2#expiration

In order to send the private message, please send the details to the alias: googleadsa...@google.com.

Thanks,

Google Logo
Lakshmi Prathipati
Google Ads API Team
 

 
 


ref:_00D1U1174p._5004Q2Lkmcl:ref

Ramesh Pun

unread,
Aug 12, 2021, 2:20:45 PM8/12/21
to AdWords API and Google Ads API Forum
Thank you Lakshmi.

pratik patel

unread,
Aug 17, 2021, 5:26:14 AM8/17/21
to AdWords API and Google Ads API Forum
Thank you Ramesh & Lakshmi. I have the same issue I think. I have also a consent screen showing in Testing.

I change the status of it and will check after 7 days. 

Regards,
Pratik Patel

Google Ads API Forum Advisor

unread,
Aug 17, 2021, 1:22:23 PM8/17/21
to anay....@gmail.com, adwor...@googlegroups.com
Hi Pratik,

Let us know if you have any further questions related to Google Ads API.
Reply all
Reply to author
Forward
0 new messages