'Failed to retrieve auth metadata with error: invalid_grant' - Exception occurred in retry method that was not classified as transient'

671 views
Skip to first unread message

Sam Pascoe

unread,
Nov 7, 2022, 7:32:46 AM11/7/22
to Google Ads API and AdWords API Forum
 I'm getting the error:

 code: 16,
  details: 'Failed to retrieve auth metadata with error: invalid_grant',
  metadata: Metadata { internalRepr: Map(0) {}, options: {} },
  note: 'Exception occurred in retry method that was not classified as transient'

re-entering a new refresh token seems to be the only fix. It happens once a week.

Google Ads API Forum Advisor

unread,
Nov 7, 2022, 8:31:28 AM11/7/22
to sam.g....@gmail.com, adwor...@googlegroups.com
Hi Sam,

Thank you for posting your concern. Allow me to provide support.

I can see that you encountered an invalid_grant error, it occurs when the refresh token has been expired or revoked. The common cause of this error is when 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. Your Google project's publishing status is "Testing", so the refresh token expires every 7 days and receives an “invalid_grant” error. Go to the Google API Console and navigate to the OAuth consent screen. Then change the publishing status to “In production” following these instructions to avoid the refresh token expiring in 7 days.

Let me know if you have further questions.

Regards,
Google Logo
Ernie John
Google Ads API Team
 


ref:_00D1U1174p._5004Q2g0yBb:ref

Sam Pascoe

unread,
Nov 7, 2022, 1:25:42 PM11/7/22
to Google Ads API and AdWords API Forum
I am using this site: https://refresh-token-helper.opteo.com/ to generate my refresh token. Should I be using a different method?

Google Ads API Forum Advisor

unread,
Nov 7, 2022, 8:56:24 PM11/7/22
to sam.g....@gmail.com, adwor...@googlegroups.com
Hi Sam,

Thank you for the reply.

I'm afraid that we are not familiar with the site you have provided. However, You may refer to this guide for the steps on how you can regenerate credentials and refresh tokens.

Best regards,
Google Logo
Heidi
Google Ads API Team
 


ref:_00D1U1174p._5004Q2g0yBb:ref

Sam Pascoe

unread,
Nov 16, 2022, 9:28:08 AM11/16/22
to Google Ads API and AdWords API Forum
I followed the link above but there is no mention of refresh tokens anywhere on the page. 

I already have a client ID and client secret

Google Ads API Forum Advisor

unread,
Nov 16, 2022, 1:06:10 PM11/16/22
to sam.g....@gmail.com, adwor...@googlegroups.com

Hi Sam,

Thank you for your reply. I'm also a member of the Google Ads API support team. Upon checking the link provided, the refresh tokens information is in the OAuth Playground section. With this, you may check this document, directly to the information about generating tokens. Let me know if you have further questions.

Best regards,

Google Logo
Jinky
Google Ads API Team
 
            

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