Hello,

I am trying to access client's campaigns via Google Ads API but I am 
failing.

I am getting this error:

"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
"

I have gone countless times through the standards, so let me recap what I 
have done and tried so far.

To be perfectly clear, the 'client' is a real account using real ads, but 
still under our control for test purposes. We have full control over the 
client in this example.

1. We have added the Customer account (789-584-XXXX) to the list of 
Sub-Accounts via the UI on the Master Manager account (506-141-XXXX).
2. The client (us again) confirmed the linking of these accounts together 
and granted access to the Manager account. The Manager account can easily 
access all the ads of the client account via UI and can see the full 
history of the client (we want to be able to perform this via API).
3. The client was sent the link to provide consent. The consent was given 
and an Authorization code was generated.
4. The Authorization code was used to generate a pair of tokens. Up to this 
point, everything went successfully as expected.
5. When the tokens are used to access client's data, we get the 403 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
"

The step 5 is where our code fails.

Let me write here the details of the HTTP request. As I trust these matters 
are handled by seasoned developers, I believe you can easily figure out the 
meaning of the code below. We are using a config object where the variables 
are stored. No hyphens are used for the accounts, so the values look like 
this: 789584XXXX or 506141XXXX:

req.setMethod('POST');
req.setHeader('Content-Type','application/json');
req.setHeader('login-customer-id',config.ManagerAccountId__c);
req.setHeader('Authorization','Bearer '+config.AccessToken__c);
req.setHeader('developer-token',config.DeveloperToken__c);
req.setEndpoint('
https://googleads.googleapis.com/v4/customers/'+config.ClientId_Account__c+'/googleAds:search'
);
req.setBody('{"pageSize": 10000,"query": "SELECT campaign.id,campaign.name, 
campaign.status, campaign.end_date, campaign.start_date, 
metrics.cost_micros, campaign.campaign_budget FROM campaign"}');

We are failing miserably.

We have tried the approach of generating credentials under the client's 
account and retrying the whole authorization flow with new client ID and 
client secret (talking now abou the app client id + secret), but we could 
not even get to the Authorization code as Google rejected the new app on 
the client's side explaining the app is only in test mode (it is true that 
we have the Basic access only on the Master manager account, because 
getting even the Basic access was a huge bureaucratic pain for us -> we do 
hope we do NOT have to submit the app for basic access for each client).

Thank you for any help.

Jakub
SaaScend 

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"AdWords API and Google Ads 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/17f309e2-4089-49a6-9200-fc1437a09c8en%40googlegroups.com.
  • C... Jakub Hancin
    • ... Jakub Hancin
      • ... AdWords API and Google Ads API Forum
        • ... Google Ads API Forum Advisor Prod
          • ... Jakub Hancin
            • ... Jakub Hancin
          • ... Google Ads API Forum Advisor Prod
    • ... Jakub Hancin
      • ... 'Matthew James Yashinsky' via AdWords API and Google Ads API Forum
      • ... AdWords API and Google Ads API Forum
        • ... 'Вячеслав Иванов' via AdWords API and Google Ads API Forum
          • ... 'Вячеслав Иванов' via AdWords API and Google Ads API Forum
            • ... Google Ads API Forum Advisor

Reply via email to