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
}
}
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
}
}
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.