What is the better way to use AdWords Api for different client accounts from Agency Account that are not linked to them.

36 views
Skip to first unread message

Crazy Maksi

unread,
Aug 22, 2018, 3:19:49 PM8/22/18
to AdWords API and Google Ads API Forum
Hello,
I need assistant with AdWords Api (we are using PHP library).

The task is to get reports for our Clients.
We have Agency Account and Developer token for it.
We need an opportunity to get reports for non-linked Clients.
Client should be able to login to Api once and let us to use his account.

I've impelented an opportunity to authorize to AdWords from different Client accounts and storing their tokens.
According step 4, i can use this data immediatly, but will i have to use this tokens later?

According this documentation https://github.com/googleads/googleads-php-lib#setting-up-your-oauth2-credentials i need to build OAuthCredential.
Can i use my ClientId and ClientSecret from Agency Account for that Clients and use only their ClientCustomerId and refresh token to build oautCredential?
And is there an opportunity to use one file for different Clients and set clientCustomerId and RefreshToken programmatically?

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Aug 23, 2018, 1:01:02 PM8/23/18
to AdWords API and Google Ads API Forum
Hello, 

Please find my responses inline:
  • According step 4, i can use this data immediately, but will i have to use this tokens later?
    The guide that you are referring to is the correct one to check. As you might have seen in the step #3, you can store the refresh token in the adsapi_php.ini. This along with your client id and client secret can be used later to get the access token and make the API calls. This way, the client will only have to authorize once (provided the access of that user on the account does not change).
  • Can i use my ClientId and ClientSecret from Agency Account for that Clients and use only their ClientCustomerId and refresh token to build oautCredential?
  • Yes, you should be using your client id and client secret along with the client's refresh token and client customer Id.
  • And is there an opportunity to use one file for different Clients and set clientCustomerId and RefreshToken programmatically?
Please let me know if you have any additional questions. 

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