How get CustomerId of Manager with OAuth 2.0

71 views
Skip to first unread message

deveopers gumption

unread,
Mar 14, 2017, 9:04:37 AM3/14/17
to AdWords API Forum

How get Customer ID of Manager with OAuth 2.0 web flow in PHP.

Now I wrote Manager customer ID by hand in adsapi_php.in file But I need Customer id of Manager at the time of  Authorization. How I can get Customer Id of Manager?

I am developing a dynamic application that used my many managers for handling their accounts so I need Manager customer ID at the time of Authorization.

Shwetha Vastrad (AdWords API Team)

unread,
Mar 14, 2017, 12:53:48 PM3/14/17
to AdWords API Forum
Hi,

Given a Google account, you can retrieve the AdWords accounts directly accessible by this account using CustomerService.getCustomers() method. To retrieve the CustomerId, you need to follow these steps:
  1. Generate client ID and client secret by following the instructions provided here. Once you have the OAuth2 credentials, you need to generate the refresh token using any of the client libraries
  2. Use CustomerService.getCustomers() method without setting the clientCustomerId header along with the credentials generated. The response will contain the details of all AdWords accounts associated with the authenticated Google account. 
Regards,
Shwetha, AdWords API Team.

deveopers gumption

unread,
Mar 15, 2017, 2:46:17 AM3/15/17
to AdWords API Forum

Hii @Shwetha I follow your steps but when I call $customerservice->getCustomers(); it show this error

Fatal error: Call to a member function generateHttpHeaders() on null

Shwetha Vastrad (AdWords API Team)

unread,
Mar 15, 2017, 9:16:18 AM3/15/17
to AdWords API Forum
Hi,

Could you enable logging and send over the logs generated for this API request? Could you also check if you have set the developerToken, Authorization and userAgent headers in your requests? Please use Reply privately to author when responding.

Thanks,
Shwetha, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages