OAuth with Javascript + AdWords API PHP library?

90 views
Skip to first unread message

Johnny

unread,
Dec 4, 2017, 4:14:06 AM12/4/17
to AdWords API Forum
Hi!

I'm creating a web pp which lets visitors authenticate via Google OAuth 2 (Javascript API), and once authentication is complete, on the same page get the list of their AdWords accounts with some basic reports about each account (CPA in last month, etc.).

I've already implemented client-side authentication within AdWords scope. Is it possible to pass the access token via AJAX, and then get the information I need via Google Ads PHP Client Library and then get the info about their associated AdWords via CustomerService? I only need temporary, read-only access. Everywhere I read it seems I need to have my own AdWords MCC account and developer token, but I don't want to manage anyone's account.

Am I overcomplicating this? Can it be simply done with javascript only (I couldn't find any info about AdWords Javascript API)?

Please point me in the right direction.

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Dec 4, 2017, 1:48:51 PM12/4/17
to AdWords API Forum
Hi Johnny, 

Once the account owner provides the authorization, your application will be able to generate the OAuth tokens which is required to make API calls against their accounts. However, you will still need an approved developer token to make the API calls. You can create a production MCC account and then apply for the API access. Once you have the approved token, the CustomerService.getCustomers() call without specifying the clientCustomerId in the header, will return all the accounts the authenticated user has access to. Are you facing any errors while setting up the AdWords API? If so, could you elaborate?

Client libraries that are supported by the AdWords API are the ones listed here. If you were looking for OAuth samples in Java client library, you can find them here. We don't have a Javascript client library. However, you could explore the option of using AdWords Scripts which uses Javascript to get data from the AdWords.

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