I am trying to connect to the google ads api through an service account. I 
am able to get the necessary authorization token, but then the api returns 
a NOT_ADS_USER error. Just to make sure I checked the 
https://console.cloud.google.com/apis/api/googleads.googleapis.com/credentials?authuser=1&project=***
 
page. Under credentials compatible with this API the service account I use 
to generate the authentication token is listed. So at this point I am 
stuck. Any thought on how to solve this?

Details authentication process and request:

GoogleCredential credential = new GoogleCredential.Builder() 
.setTransport( httpTransport ) 
.setJsonFactory( JSON_FACTORY ) 
.setServiceAccountId 
<https://www.codota.com/code/java/methods/com.google.api.client.googleapis.auth.oauth2.GoogleCredential$Builder/setServiceAccountId>(
 
serviceAccountEmail ) 
.setServiceAccountScopes( 
Collections.singleton("https://www.googleapis.com/auth/adwords"; ) )
 .setServiceAccountPrivateKeyFromP12File( pk12Filepk12File ) 
.build(); 
 
credential.refreshToken();
accessToken = credential.getAccessToken();

curl.exe --request POST 
"https://googleads.googleapis.com/v5/customers/******/googleAds:searchStream"; 
--header "Content-Type: application/json" --header "Authorization: Bearer 
******" --header "developer-token: ******" --data "{'query': 'SELECT * FROM 
campaign WHERE segments.date DURING YESTERDAY'}" 

Json Responds
 [{ "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.v5.errors.GoogleAdsFailure", 
"errors": [ { "errorCode": { "authenticationError": "NOT_ADS_USER" }, 
"message": "User in the cookie is not a valid Ads user." } ] } ] } } ] 

 I read a similar post here: 
https://groups.google.com/g/adwords-api/c/_CEOICa97V8/m/DIhpo44TAwAJ . 
However no solution was provided.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/452c8274-aa76-4338-ab95-8be245aa289dn%40googlegroups.com.

Reply via email to