Hello,
I am trying to access client's campaigns via Google Ads API but I am
failing.
I have set the in the header but I get the USER_PERMISSION_DENIED error.
source code:
-----
$googleAdsClient = (new GoogleAdsClientBuilder())
->fromFile()
->withLoginCustomerId('2888587923')
->withOAuth2Credential($oAuth2Credential)
->build();
-----
I am getting the following error:
-----
google-ads.WARNING: Request made: Host: "googleads.googleapis.com", Method:
"/google.ads.googleads.v7.services.GoogleAdsService/SearchStream",
CustomerId: 3724850960, RequestId: "aZ7zFykOk4ZjZwwthfjOnw", IsFault: 1,
FaultMessage: "["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"]"
[2021-05-27T06:35:30.264752+00:00] google-ads.NOTICE: Request
-------
Method Name: /google.ads.googleads.v7.services.GoogleAdsService/SearchStream
Host: googleads.googleapis.com
Headers: {
"x-goog-api-client": "gl-php\/8.0.6 gapic\/ gax\/1.7.1 grpc\/1.38.0",
"x-goog-request-params": "customer_id=3724850960",
"developer-token": "REDACTED",
"login-customer-id": "2888587923"
}
Request:
{"customerId":"3724850960","query":"SELECT campaign.id, campaign.name FROM
campaign ORDER BY campaign.id"}
Response
-------
Headers: {
"request-id": "aZ7zFykOk4ZjZwwthfjOnw",
"date": "Thu, 27 May 2021 06:35:30 GMT",
"alt-svc": "h3-29=\":443\"; ma=2592000,h3-T051=\":443\";
ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\";
ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000;
v=\"46,43\""
}
Fault
-------
Status code: 7
Details: The caller does not have permission
Failure:
{"errors":[{"errorCode":{"authorizationError":"USER_PERMISSION_DENIED"},"message":"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"}],"requestId":"aZ7zFykOk4ZjZwwthfjOnw"}
Request with ID 'aZ7zFykOk4ZjZwwthfjOnw' has failed.
Google Ads failure details:
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
-----
Thank you for any help.
Alex
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/fff01d3b-5464-43eb-be22-d598b05feaf1n%40googlegroups.com.