Request is missing required authentication credential

2,383 views
Skip to first unread message

Walter Bodwell

unread,
Feb 7, 2022, 10:30:36 AM2/7/22
to Google Ads API and AdWords API Forum
I have two Google OAuth applications.  One is used for testing and hits a sandbox account.  The other just got verified for production use and is hitting our production account.

The sandbox version is working just fine.  The same code fails on the production version.

When I try to call the new Google Ads API using the production version, I'm getting:
google.ads.googleads.errors.GoogleAdsException: (<_SingleThreadedRendezvous of RPC that terminated with: status = StatusCode.UNAUTHENTICATED details = "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project." debug_error_string = "{"created":"@1644245725.347305819","description":"Error received from peer ipv4:142.250.73.202:443","file":"src/core/lib/surface/call.cc","file_line":1074,"grpc_message":"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}" >, <_SingleThreadedRendezvous of RPC that terminated with: status = StatusCode.UNAUTHENTICATED details = "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project." debug_error_string = "{"created":"@1644245725.347305819","description":"Error received from peer ipv4:142.250.73.202:443","file":"src/core/lib/surface/call.cc","file_line":1074,"grpc_message":"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}" >, errors { error_code { authentication_error: AUTHENTICATION_ERROR } message: "Authentication of the request failed." } request_id: "fPZpK5epSvpfmvbC3luD-w" , 'fPZpK5epSvpfmvbC3luD-w')

When I try to call the old Google AdWords API with the production version, I'm getting:
googleads.errors.AdWordsReportBadRequestError: Type: QuotaCheckError.INVALID_TOKEN_HEADER

I've verified the client id, client secret, token and refresh token and it matches what I used / got when I went through the Oauth process (i.e., I'm not mixing the sandbox and production credentials).

The only noticeable difference between the sandbox and production credentials is that the token is much longer for production (163 characters for production; only 22 for sandbox)

Thanks for your help,
Walter

Walter Bodwell

unread,
Feb 7, 2022, 1:04:39 PM2/7/22
to Google Ads API and AdWords API Forum
I see what I did wrong.  For the production account, I need to use the AdWords developer token.  I was erroneously using the access token from OAuth.  The sandbox account must have let me slide on this.  The production account, not so much.

Walter

Google Ads API Forum Advisor

unread,
Feb 7, 2022, 11:56:10 PM2/7/22
to wbod...@ftoptimize.com, adwor...@googlegroups.com

Hi Walter,

Thanks for reaching out to the Google Ads API Forum.

You may double check in your Google Ads API request that the supplied developer token is valid. You may ensure that a developer token has been set and matches the value in the Google Ads UI’s API Center.

If the issue persists with Google Ads API, please share with us the complete request and response logs (along with the request-id) as seen in their respective links via reply author to privately option. If you are using a client library, you may first enable logging by navigating to the Client libraries > Your client library (ex. Java) > Logging documentation, which you can access from this link.

With regards to the INVALID_TOKEN_HEADER error in AdWords API, if your developer token is new, and created after April 28, 2021, then as per this guide, AdWords API is no longer available for new users. You may continue to use Google Ads API instead.

Let us know how this goes on your end.

Regards,

Google Logo
Yasar
Google Ads API Team
 


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