"error": "invalid_client", "error_description": "Unauthorized"

3,170 views
Skip to first unread message

pqm peng

unread,
May 9, 2023, 4:23:10 AM5/9/23
to Google Ads API and AdWords API Forum
response:
{
    "error""invalid_client",
    "error_description""Unauthorized"
}



follow example: Generating new access tokens

Once you have a client IDclient secret, and refresh token, you can generate a new access token for use in API calls with the curl command line tool:

Note: The version v3 in the OAuth endpoint URL is unrelated to the Google Ads API version and should not change when migrating to newer versions of Google Ads API.
curl \
 
--data "grant_type=refresh_token" \
 
--data "client_id=CLIENT_ID" \
 
--data "client_secret=CLIENT_SECRET" \
 
--data "refresh_token=REFRESH_TOKEN" \
  https
://www.googleapis.com/oauth2/v3/token

Google Ads API Forum Advisor

unread,
May 9, 2023, 10:33:54 AM5/9/23
to pqm...@gmail.com, adwor...@googlegroups.com

Hi,

I'm from the Google Ads API support team.

It appears that you’ve received the ‘invalid_client’ error. I suggest to recreate the client id and client secret and generate a refresh token using the new client id and client secret key. You may refer to the web app flow instructions (https://developers.google.com/identity/protocols/oauth2/web-server#obtainingaccesstokens) in this OAuth2.0 guide (https://developers.google.com/google-ads/api/rest/auth#using_desktop_or_web_app_flows) for the complete instructions.

Should you continue to encounter issues with the OAuth credentials in your client library, even after following the steps from the above guide, I would recommend that you reach out instead to the Google API Console Support team via this link (https://support.google.com/googleapi/answer/7014572?hl=en).

Regards,

Google Logo Google Ads API Team


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