Hi
PHP 8
Google Ads V9 => 13.0.0
Im getting the Customer Manager Links from my account 6765096429:
Array
(
[resource_name] =>
customers/6765096429/customerManagerLinks/2508518472~216663108
[status] => ACTIVE
[manager_customer] => customers/2508518472
[manager_link_id] => 216663108
)
At the next step I want to query the Customer Client "customers/2508518472"
to get their descriptiveName but I receive an authorization error:
authorization_error: 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#cid
Im passsing the customer 6765096429 like customer_login_id in the
credentials:
$oAuth2Credential = (new OAuth2TokenBuilder())
->withClientId($client_id)
->withClientSecret($secret)
->withRefreshToken($refresh_token)
->build();
$googleAdsClient = (new GoogleAdsClientBuilder())
->withDeveloperToken($developer_token)
->withOAuth2Credential($oAuth2Credential)
->withLoginCustomerId(6765096429)
->build();
// Here, I query customer client 2508518472 to get the descriptiveName
$customerId=2508518472;
$query = 'SELECT customer_client.client_customer, customer_client.level,'
. ' customer_client.manager, customer_client.descriptive_name,'
. ' customer_client.currency_code,
customer_client.time_zone,customer_client.test_account,'
. ' customer_client.id FROM customer_client
limit 1';
$googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();
$customer = $googleAdsServiceClient->search($customerId,
$query)->getIterator()->current()->getCustomerClient();
print "name: ".$customer->getDescriptiveName();
At this point I receive the authorization_error
What am I doing wrong?
Best regards
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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
"Google Ads API and AdWords 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/fcb5e917-1e88-4d21-8249-aed321467f4dn%40googlegroups.com.