Error: 16 UNAUTHENTICATED: Failed to retrieve auth metadata with error: invalid_grant

3,017 views
Skip to first unread message

Adnan Hassan

unread,
Jul 3, 2022, 2:55:36 PM7/3/22
to Google Ads API and AdWords API Forum
I am using google ads api for reporting and keyword plan purposes in our application. it was working perfectly fine some time ago But now i'm facing this error 

Error: 16 UNAUTHENTICATED: Failed to retrieve auth metadata with error: invalid_grant
    at Object.callErrorFromStatus (C:\Users\ssc\Desktop\google api final\node_modules\@grpc\grpc-js\build\src\call.js:31:26)
    at Object.onReceiveStatus (C:\Users\ssc\Desktop\google api final\node_modules\@grpc\grpc-js\build\src\client.js:180:52)
    at Object.onReceiveStatus (C:\Users\ssc\Desktop\google api final\node_modules\@grpc\grpc-js\build\src\client-interceptors.js:365:141)
    at Object.onReceiveStatus (C:\Users\ssc\Desktop\google api final\node_modules\@grpc\grpc-js\build\src\client-interceptors.js:328:181)
    at C:\Users\ssc\Desktop\google api final\node_modules\@grpc\grpc-js\build\src\call-stream.js:182:78
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  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'
}

Google Ads API Forum Advisor

unread,
Jul 3, 2022, 9:57:31 PM7/3/22
to adnanha...@gmail.com, adwor...@googlegroups.com
Hi Adnan,

Thank you for posting your concern.

One of the possible reasons for invalid_grant error is when your refresh token has been expired or revoked. Please note 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. With this, to provide a workaround for this 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._5004Q2cFpvd:ref
Reply all
Reply to author
Forward
0 new messages