How to get customer id from credentials

63 views
Skip to first unread message

Kamil Buczko

unread,
Dec 10, 2020, 10:16:56 AM12/10/20
to AdWords API and Google Ads API Forum
Hello,

I have a task to integrate with Google ads system.
I already implemented an authentication flow, so when new client uses my system and connects his Google Ads account to my system I receive his account credentials(access/refresh tokens) and store them in a database.

Now i want to download data from his google ads account and in order to do this i need his customer id. Is there any way to get google ad customer id in exchange for credentials?

I am using Java with google ads sdk (v6)

Thanks,
Kamil

Google Ads API Forum Advisor Prod

unread,
Dec 11, 2020, 3:55:16 PM12/11/20
to kamil...@gmail.com, adwor...@googlegroups.com

Hi Kamil,

Thank you for reaching out. To fetch the user customer id based on their credentials, you could use CustomerService.ListAccessibleCustomers via the Google Ads API to achieve it if the user authenticates with their manager account. However, if this does not work, please try to use CustomerService.getCustomers() via the AdWords API to fetch the user customer id.

Thanks and regards,
Xiaoming, Google Ads API Team

Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q28oyoA:ref

Kamil Buczko

unread,
Dec 14, 2020, 12:56:39 PM12/14/20
to AdWords API and Google Ads API Forum
ListAccessibleCustomers is not working because i don't have loginCustomerId set in GoogleAdsClient, so when i call listAccessibleCustomers i get an error.
I can't see getCustomers() method in java sdk CustomerServiceClient implementation. The only method is getCustomer() which requires customerId.

Google Ads API Forum Advisor Prod

unread,
Dec 15, 2020, 11:45:41 AM12/15/20
to kamil...@gmail.com, adwor...@googlegroups.com

Hi Kamil,

Thank you for reaching out. Please consider using CustomerService.getCustomers() via the AdWords API to fetch the user customer id. You could use this method to fetch the customer id by setting the OAuth2 credentials provided by the user.



Thanks and regards,
Xiaoming, Google Ads API Team

 

Reply all
Reply to author
Forward
0 new messages