(Second attempt because my first post did not appear after a day)

Usage of the Google Ads REST interface does not work, yet using the same 
OAuth credentials in a client library (.NET, gRPC) works fine.

   1. Ask for consent by navigating to:
   
   
   
https://accounts.google.com/o/oauth2/v2/auth?client_id=X&redirect_uri=http://127.0.0.1:4200&response_type=code&scope=https://www.googleapis.com/auth/adwords&access_type=offline&include_granted_scopes=true&prompt=consent
   
   *The code is manually copied (and decoded) from the URL since I'm using 
   Postman to test.*
   2. Get access and refresh token using URL:
   
   POST *https://oauth2.googleapis.com/token*
   *Headers*
   Content-Type: x-www-form-urlencoded
   *Body*
   client_id=X
   client_secret=X
   code=STEP_1_CODE
   grant_type=authorization_code
   redirect_uri=http://127.0.0.1:4200
   
   Refreshing the token with grant_type refresh_token also works as 
   expected. Access tokens from the authorization_code and refresh_token grant 
   have been tested in step 3.
   3. Use access_token from step 2 to call listAccessibleCustomers
   
   GET 
   *https://googleads.googleapis.com/v12/customers:listAccessibleCustomers*
   *Headers*
   Authorization: Bearer STEP_2_ACCESS_TOKEN
   developer-token: X
   login-customer-id: X

All steps work as expected until the last call to the REST API, which 
yields the below response signaling that the Authorization token is not 
even present in the request. The link in the error takes you to 
documentation warning not to use a deprecated javascript library, but I 
followed the official documentation from the REST Interface 
overview: https://developers.google.com/google-ads/api/rest/auth

Furthermore using the refresh token from the same response of step 2 in a 
client library  (.NET) works perfectly fine, so I don't see where I'm 
messing up. Am I missing any step to access the Google Ads REST API? Is it 
possible that the REST API is not enabled somehow? Help is much appreciated.

{
    "error": {
        "code": 401,
        "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.";,
        "status": "UNAUTHENTICATED",
        "details": [
            {
                "@type": 
"type.googleapis.com/google.ads.googleads.v12.errors.GoogleAdsFailure",
                "errors": [
                    {
                        "errorCode": {
                            "authenticationError": "AUTHENTICATION_ERROR"
                        },
                        "message": "Authentication of the request failed."
                    }
                ],
                "requestId": "2C7jovVN7yqTsQSe04csSg"
            }
        ]
    }
}

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/c7d2f50c-d95a-4aea-8b55-48a587fc653fn%40googlegroups.com.
  • Ca... Errors4l
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to