Hello, 

One of our lambda is retrieve campaign data but since begining of July it's 
not working anymore, we get the following error 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#login-customer-id

We tried to understand why we have this message but we're clueless now.
Here's what we checked:
- Client ID & Client Secret (they're correct)
- CUSTOMER_ACCOUNT_ID (it's referring to the account we want to get google 
ads campaign)
- DEVELOPER_TOKEN (it's the same as shown in the manager account)
- LOGIN_CUSTOMER_ID (it's the manager account ID)
- GOOGLE_REFRESH_TOKEN (I tried to refresh it and use the refreshed 
version.)

I also tried to run a basic code in Ruby in order to see if that wasn't 
because we're using NodeJS and the error is the same but I have a 
confirmation that the right login-customer-id is sent:

> I, [2020-07-31T11:32:02.648165 #441]  INFO -- : Outgoing request: 
Headers: {"x-goog-api-client":"gl-ruby/2.5.5 gapic/6.0.0 gax/1.8.1 
grpc/1.28.0","developer-token":"mVM-XXXXXXXXXXXX","login-customer-id":"516XXXXXXX","x-goog-request-params":"customer_id=600XXXXXXX"}
 
Payload: {"customerId":"600XXXXXXX","query":"SELECT campaign.id,\n      
 campaign.name,\n       segments.date,\n       metrics.impressions,\n      
 metrics.clicks,\n       metrics.cost_micros\nFROM campaign\nWHERE 
segments.date DURING LAST_7_DAYS\n  AND campaign.status = 'ENABLED'\nORDER 
BY segments.date DESC\n","pageSize":10}

Here's the code I ran:
  client = Google::Ads::GoogleAds::GoogleAdsClient.new(version: :v4) do 
|config|
    config.client_id = GOOGLE_CLIENT_ID
    config.client_secret = GOOGLE_CLIENT_SECRET
    config.developer_token = GOOGLE_DEVELOPER_TOKEN
    config.login_customer_id = GOOGLE_LOGIN_CUSTOMER_ID
    config.refresh_token = GOOGLE_REFRESH_TOKEN
    config.log_target = STDERR
    config.log_level = 'INFO'
    
  end
  campaign_service = client.service.campaign
  ga_service = client.service.google_ads
  query = <<~QUERY
      SELECT campaign.id,
             campaign.name,
             segments.date,
             metrics.impressions,
             metrics.clicks,
             metrics.cost_micros
      FROM campaign
      WHERE segments.date DURING LAST_7_DAYS
        AND campaign.status = 'ENABLED'
      ORDER BY segments.date DESC
    QUERY

  response = ga_service.search(GOOGLE_CUSTOMER_ACCOUNT_ID, query, 
page_size: 10)

If anyone has an idea, I'd be glad to try it.

Best Regards,
Youri Nouri

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/3a15f558-0775-428a-809c-9aa6d9289adbn%40googlegroups.com.

Reply via email to