Google Ads refresh token failing randomly after 2 to 14 days.

63 views
Skip to first unread message

Kevin Lesieutre

unread,
Apr 29, 2025, 8:15:20 PMApr 29
to Google Ads API and AdWords API Forum
I've read a lot of threads on the subjects but I can't find why my Google Ads refresh token would keep expire after few days and I wouldn't be able to create any access tokens from it.

I've tried to create new credentials from scratch etc.. But nothing works, each time I have to refresh it because i'm getting this error : 
google.auth.exceptions.RefreshError: ('invalid_grant: Token has been expired or revoked.', {'error': 'invalid_grant', 'error_description': 'Token has been expired or revoked.'})


Then I would manually have to do the whole oauth process again to get a new one and use it..

How to fix it ?


( It wasnt hapening before, i've had refresh token works for like 3 months before without having any issue. ) .

Google Ads API Forum Advisor

unread,
Apr 30, 2025, 2:02:25 AMApr 30
to lesieut...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

I understand that you are encountering the "invalid_grant" error while working with the Google Ads API. The common cause for this error is that a Google Cloud Platform project with an OAuth consent screen configured for an external user type and a publishing status of 'Testing' is issued a refresh token expiring in 7 days. To handle this error, go to the Google API Console and navigate to the OAuth consent screen. Then change the publishing status to 'In production' to avoid the refresh token expiring in 7 days. For more details about the refresh token expiration, refer to the Google Identity Platform OAuth documentation.

Also, an access token has an expiration time (based on the expires_in value) after which the token is no longer valid. You can use the refresh token to refresh an expired access token. By default, our client libraries automatically refresh expired access tokens. You may refer to this guide on 'Fetch a refresh token', which uses the oauth2l command instead of curl to fetch the OAuth 2.0 refresh tokens. Another option for generating OAuth2 credentials is to use the OAuth2 Playground. The OAuth2 Playground, in conjunction with the Google API Console, lets you manually create OAuth2 tokens. You may also check this sample code for generating user credentials.

I hope this helps.
 

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-04-30 06:01:40Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01qVORW:ref" (ADR-00302945)



Reply all
Reply to author
Forward
0 new messages