Getting OAuth 2.0 Access Token for Google AdWords API access
Accessing AdWords data via the Google AdWords API can be confusing and complicated, especially with the way Google Services API OAuth works.
In order to access AdWords via API, you'll (or your codes) need to be authenticate via through OAuth 2.0. This guide is focusing on getting the OAuth Access token so that you can call the API from your codes.
To do this, we'll first need to create a credential to access the API. API credentials are manage with Google Developer Console.
In order to access AdWords via API, you'll (or your codes) need to be authenticate via through OAuth 2.0. This guide is focusing on getting the OAuth Access token so that you can call the API from your codes.
To do this, we'll first need to create a credential to access the API. API credentials are manage with Google Developer Console.
- Create New Client ID using Google Developers Console. (See the steps here https://developers.google.com/adwords/api/docs/guides/authentication - Create a client identifier and client secret)
- During the step #7 choose Web application and enter
- "https://developers.google.com" in AUTHORIZED JAVASCRIPT ORIGINS
- "https://developers.google.com/oauthplayground" in AUTHORIZED REDIRECT URIS
- Save and you will see the Client ID being created as below
- Head over to https://developers.google.com/oauthplayground, click on the gear icon on the top right corner and you'll see the following dialog.
- Check "Use your own OAuth credentials", and enter according the the screen shot below. The Adwords API is not in the selection, so you need to manually input "https://adwords.google.com/api/adwords" in the Select & authorize APIs input field.
See the highlighted boxes in the screenshot. You'll also need the Cliend ID information that you previously generate. - Click the "Authorize APIs" button and login with your AdWords Account when prompted (only if you're not already logged in)
- You will then be redirected back to the OAuth 2.0 Playground's Step 2. At this point, an Authorization code has been generated for the Client ID.
- Click on "Exchange authorization code for tokens" button, and the Access token will be generated for you. There will be a counter telling you when the Access token is going to be expired and you'll need to click the "Refresh access token" to renew it.
- That's it, that is how you get the OAuth 2.0 Access token for Google AdWords API.
Comments
Post a Comment