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.

  1. 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)
  2. 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
Next, we're going to get a token for our API calls. This actually involves getting an Authorization code, a Refresh token and an Access token (this is the token we need for API calls).
  1. 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.

  2. 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.


  3. Click the "Authorize APIs" button and login with your AdWords Account when prompted (only if you're not already logged in)
  4. 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.

  5. 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.
  6. That's it, that is how you get the OAuth 2.0 Access token for Google AdWords API.

Comments

Popular posts from this blog

Generating INSERT statement from SELECT using SQuirreL SQL

OneNote: We need the password to sync this notebook (Error code: 0xE4010643)

Fixing the AKE BC398 USB3.0 sluggish performance