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