RE: authorization_error: User doesn't have permission to access customer

2022-04-27 Thread 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
Hi Miguel,

Thank you for reaching out.

To investigate the issue further, could you please provide the complete request 
and response logs, with the request-id? If you haven't yet, logging can be 
enabled by navigating to the Client libraries > Your client library (ex. Java) 
> Logging documentation, which you can access from this link. You can provide 
it via Reply privately to author option. If this option is not available, then 
send it instead on this email address googleadsa...@google.com.

Thanks,

Nirmita
Google Ads API Team
ref:_00D1U1174p._5004Q2aO1U0:ref

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/YKvJS0RB0CZC00Sb5wo9ezS0KkCkOfgfpc3Q%40sfdc.net.


authorization_error: User doesn't have permission to access customer

2022-04-27 Thread Miguel Angel Calleja
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.