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 Ads API Team Feedback How was our support today? [2025-04-30 06:01:40Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01qVORW:ref" (ADR-00302945) -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 visit https://groups.google.com/d/msgid/adwords-api/akSt1000000000000000000000000000000000000000000000SVIOQS00vxWXGtJORmC-GaRqGQXd_w%40sfdc.net.