Invalid customer ID for service account

137 views
Skip to first unread message

Alley

unread,
Jun 25, 2022, 10:58:54 PM6/25/22
to Google Ads API and AdWords API Forum
Using service account, nodejs, not using a client. This setup works great for Analytics, failing to get anything back from Ads.
  • Auth performs fine, get JWT and sending Developer-token header w/ the access token as Bearer
  • Every request to googleAds:searchStream results in INVALID_ARGUMENT -> INVALID_CUSTOMER_ID
  • The customer ID is correct, the developer token is issued by the Manager account with access to the customer ID
Thinking it's some access or permission issue, but nothing is out of the ordinary here. There's two things which may be funky:
  1. The email associated with the Manager account is both a User on the customer ID account and a manager
  2. There's an errant old Manager account associated with that email, but it does not have Basic access to API and the token is not the token in use here
Any help would be appreciated, beating my head against a wall. The query being sent to the endpoint is vanilla, result is the same even with a blank payload or something as simple as "SELECT campaign.name FROM campaign."

Alley

unread,
Jun 26, 2022, 6:07:07 PM6/26/22
to Google Ads API and AdWords API Forum
More debug:
  • Carefully read docs, realized service accounts can only communicate with the Ads API via impersonating a user
  • Added domain-wide delegation in Workspace for the service account, scoped to https://www.googleapis.com/auth/adwords
  • The JWT now included sub with the email being an email that has access to all clients' Ads accounts
  • Redid flow for getting access token, same result. "Invalid customer ID <an actual client customer ID>"

Alley

unread,
Jun 26, 2022, 9:05:41 PM6/26/22
to Google Ads API and AdWords API Forum
This is solved. For others that get here, it was simple: The other APIs like Analytics take customer ID as they present it on the site, "xxx-xxx-xxxx." The Ads API requires it to be only numeric, so the dashes need to be stripped out.

Google Ads API Forum Advisor

unread,
Jun 26, 2022, 9:51:31 PM6/26/22
to al...@alleyford.com, adwor...@googlegroups.com
Hi Alley,

Thank you for updating us that this issue has been resolve.

With regard to, "The Ads API requires it to be only numeric, so the dashes need to be stripped out.", this is indeed correct. When specifying your customer ID in your request, you should note that you need to remove the hyphens (-). When you used this with hyphens, then you will really encounter an error.

Regards,
Google Logo
Carmela
Google Ads API Team
 


ref:_00D1U1174p._5004Q2cD8vF:ref
Reply all
Reply to author
Forward
0 new messages