With the "Google Ads API" - PHP Client Library.
While calling the " GetCampaigns.php
" / " ListAccessibleCustomers.php
" example code. I was still getting this error (below) but found a solution (check answer).
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
Fix -
Pass the Manager account's ID (in my case test manager account) = $loginCustomerId
->withLoginCustomerId($loginCustomerId)
So in the “ GoogleAdsClientBuilder
” -
$googleAdsClient = (new GoogleAdsClientBuilder())
->fromFile()
->withOAuth2Credential($oAuth2Credential)
->withLoginCustomerId($loginCustomerId)
->build();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.