Im building an app with google ads api using a *service account* auth flow
(server to server). The problem - the auth part is not working...
*Sample of the request:*
```
request({ 'method': 'GET', 'url':
'https://googleads.googleapis.com/v6/customers/XXXXXXXX', 'headers': {
'Authorization': 'Bearer XXXXXXXX', 'developer-token': 'XXXXXXXX',
'Content-Type': 'application/json' } })
```
or
curl --location --request GET
'https://googleads.googleapis.com/v6/customers/XXXXXXXX' \ --header
'Authorization: Bearer XXXXXXXX' \ --header 'developer-token: XXXXXXXX' \
--header 'Content-Type: application/json' [ERROR] Response from google ads
api:{ "code": 401, "message": "Request had invalid authentication
credentials. 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" }
*[ERROR] Response from google ads api:*{ "code": 401, "message": "Request
had invalid authentication credentials. 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" }
I cant seem to find out why Im getting this authentication error.
What I have tried:
1. Following this guide step by step ->
https://developers.google.com/google-ads/api/docs/oauth/service-accounts
2. Using the python library ->
https://github.com/googleads/googleads-python-lib
3. Using the google ads API with REST (no library)
Whatever method / library I try, it results in the same error.
Created a google ads manager account
- Generated a valid developer token for that account
- Created project in Google cloud platform
- Opened a service account inside the project
- Created a private key for the service account
- Enabled domain-wide delegation for the service account
- Granting impersonation abilities in the G Suite domain for this scope:
*https://www.googleapis.com/auth/adwords
<https://www.googleapis.com/auth/adwords>*
- Using a g-suite domain
- Generated the *access token* with the key json file.
- Made the request to *google ads api* from localhost and also from the
web-app (which matches the g-suite domain). Both of them give me the same
401 error.
*I am surely missing something, but am not sure what it is..*
Will be super grateful if someone can share a solution!! thanks champs 👍
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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
"AdWords API and Google Ads 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/4baa8b9a-be9c-4a99-b3fd-df6244d63d05n%40googlegroups.com.