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:
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
$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