Hi,
I have an account about google ads as Master MCC as Root Manager Account 1.
and I want to get customer client ad accounts(Account A, Account B, Account
C).
UserCredentials credentials = UserCredentials.newBuilder()
.setClientId("{Root Manager's client Id}")
.setClientSecret("{Root Manager's secret}")
.setRefreshToken("{Root Manager's refresh token}")
.build();
GoogleAdsClient googleAdsClient = GoogleAdsClient.newBuilder()
.setCredentials(credentials)
.setDeveloperToken("{Root Manager's developer token which is ")
.setLoginCustomerId(Long.parseLong("{Manager Account 2's customer id}"))
.build();
final String clientQuery =
"SELECT customer_client.client_customer, customer_client.level "
+ "FROM customer_client";
GoogleAdsServiceClient googleAdsServiceClient = googleAdsClient.getVersion1
().createGoogleAdsServiceClient();
SearchGoogleAdsRequest request;
GoogleAdsServiceClient.SearchPagedResponse response;
GoogleAdsServiceClient.SearchPagedResponse customerResponse;
request = SearchGoogleAdsRequest.newBuilder()
.setCustomerId(String.valueOf(googleAdsClient.getLoginCustomerId()))
.setPageSize(PAGE_SIZE)
.setQuery(clientQuery)
.build();
response = googleAdsServiceClient.search(request)
This is an error.
10:17:06.329 [Gax-3] WARN c.g.a.googleads.lib.request.summary - FAILURE
REQUEST SUMMARY. Method:
google.ads.googleads.v1.services.GoogleAdsService/Search, Endpoint:
googleads.googleapis.com:443, CustomerID: 6803928870, RequestID:
fW3CsG9gHMBZgV4n5lAHvw, ResponseCode: PERMISSION_DENIED, Fault: The caller
does not have permission.
Headers:
Metadata(content-type=application/grpc,request-id=fW3CsG9gHMBZgV4n5lAHvw,date=Tue,
25 Feb 2020 01:17:06 GMT,alt-svc=quic=":443"; ma=2592000;
v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443";
ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443";
ma=2592000,h3-Q043=":443"; ma=2592000)
Body: null
Failure message: errors {
error_code {
authorization_error: USER_PERMISSION_DENIED
}
message: "User doesn\'t have permission to access customer. Note: If
you\'re accessing a client customer, the manager\'s customer id must be set
in the \'login-customer-id\' header. See
https://developers.google.com/google-ads/api/docs/concepts/call-structure#login-customer-id"
}
Status: Status{code=PERMISSION_DENIED, description=The caller does not have
permission, cause=null}.
Request ID {} failed due to GoogleAdsException. Underlying errors
errors {
error_code {
authorization_error: USER_PERMISSION_DENIED
}
message: "User doesn\'t have permission to access customer. Note: If
you\'re accessing a client customer, the manager\'s customer id must be set
in the \'login-customer-id\' header. See
https://developers.google.com/google-ads/api/docs/concepts/call-structure#login-customer-id"
}
How can I get a client account C from within Manager Account 3.
Can I put Manager Account 3 in here
.setLoginCustomerId(Long.parseLong("{Manager Account 3's customer id}"))
and update the UserCredentials above using the OAuth2 certified refresh
token of Manager Account3?
.setRefreshToken("{Root Manager certified to Manager Account 3. which
returned refresh token}")
Root Manager Account1 can access only Manager Account 2, but can't access
Manager Account 3.
When I call acceesible account list API.
just response data which include ads manager Account 2.
How can it access Manager Account 3.
I'm not sure I'm missing something.
Do I need to authenticate using the credentials of the master MCC account
and specify the customer id as this master account?
I tried but didn't work.
Thank you.
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/84b47cb3-7952-4545-b580-4cc4e564ba2e%40googlegroups.com.