Identify login customer id after outh2 flow using getCustomer

59 views
Skip to first unread message

Rten Marketo

unread,
Jan 14, 2022, 5:33:06 AM1/14/22
to AdWords API and Google Ads API Forum
Hi Team,
 
We use customerService.getCustomers call to get login CustomerId from logged-in user's OAuth2 credential . 
As per this blog multiple google ads-account can be associated with a single google account(i.e under a single gmail address). Hence getCustomers api's  response will consist of a list of customers details.(same is mentioned on access-multiple-adwords-accounts blog) 

We would think of below possibility of multiple google ads-accounts use case within a single google account. 
1. One manager and multiple ads accounts
2. Multiple ads accounts
3. Multiple manager and multiple ads accounts 

Do the above use cases are real or hypothetical? If yes, How to identify parent account's customer Id from getCustomers response using the logged-in user's oAuth2 credential? Is there any other API which can help us to achieve this?

Tried understanding the above cases by creating accounts within my test manager(R10) account(i.e by using "create new account" or "create new manager account" under the sub account setting of Manager account). (Referred creating new ad accounts page).
Below are the accounts we created . 
i.e Normal Adaccount -> r21 test account. 
Manager account -> r10-child-manager  Screenshot 2022-01-14 at 2.34.38 PM.png
But still I could see only one customer details under getCutomers api call from the OAuth2 credential of my test manager account. Why is there only one customer details under the getCustomer API call of my Test account? Is something I missed while creating a new ads account with the logged-in credential of my test Manager account? Thanks in advance.

Google Ads API Forum Advisor

unread,
Jan 14, 2022, 4:01:33 PM1/14/22
to r10.m...@gmail.com, adwor...@googlegroups.com
Hello,

Thanks for reaching out. The login customer ID concept is unique to the Google Ads API, though the documentation and service you mention are from the AdWords API.

It sounds like you are trying to get the customer ID of a manager above the manager that you are authenticating as. This is not currently possible in the Ads API, though it is possible in the UI, by navigating to Tools & Settings => Access & Security => Managers tab. It is possible to get the account hierarchy under each accessible account (based on OAuth credentials).

Please let us know if you want us to submit a feature request on your behalf for the retrieval of manager CIDs for a given account. If there is anything we should add, please let us know.

Regards,
Matt
Google Ads API Team

Google Logo
Matt
Google Ads API Team
 


ref:_00D1U1174p._5004Q2Uk24C:ref

Rten Marketo

unread,
Jan 17, 2022, 1:56:00 PM1/17/22
to ads...@forumsupport.google, adwor...@googlegroups.com
Thanks Matt for the quick response. 

As mentioned login customer ID concept page , I am also more interested to get/select the top manager account associated with the logged-in user oauth2 credentials,

Select the appropriate manager account

If there are multiple manager accounts for a given operating customer account, select the manager account at the top of the hierarchy. This lets you maintain the same login-customer-id for multiple calls throughout the hierarchy of accounts and thereby avoid excessive switching.



Currently Adwords API is being used in our production instances. Hence we are using getCustomer Adword API without customer Id to get the customer details.
Sample request is like below

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v20="https://adwords.google.com/api/adwords/mcm/v201809" xmlns:v201="https://adwords.google.com/api/adwords/cm/v201809">
<soapenv:Header>
<v20:RequestHeader>
<!--Optional:-->
<v201:developerToken>redacted</v201:developerToken>
<!--Optional:-->
<v201:userAgent>redacted</v201:userAgent>
<!--Optional:-->
<v201:validateOnly>false</v201:validateOnly>
<!--Optional:-->
<v201:partialFailure>true</v201:partialFailure>
</v20:RequestHeader>
</soapenv:Header>
<soapenv:Body>
<v20:getCustomers xmlns="https://adwords.google.com/api/adwords/mcm/v201809">

</v20:getCustomers>/>
</soapenv:Body>
</soapenv:Envelope> 



Suppose we have the below account hierarchy. 

Screenshot 2022-01-18 at 12.05.28 AM.png


Suppose, a
ll the accounts present under the above pic are associated with the single logged-in credential (say te...@gmail.com) . i.e If we make a getCustomers call using oauth Credential of te...@gmail.com, we will get a list of customer details (as mentioned on access-multiple-adwords-accounts blog) .

How to identify the top manager account Id (Root manager Account 1's customer Id) from getCustomers response
Unfortunately I am not able to create this structure using my test account. However  I would like to understand how to select the manager account at the top of the hierarchy from the getCustomers response. 


Regards, 
R10.marketo


Reply all
Reply to author
Forward
0 new messages