Tuesday, July 30, 2013

OAuth2 in the Ads APIs

Update: we have recently migrated code projects to GitHub and the links in the table below now point to new locations.


If you’re not using OAuth2, this blog post is aimed at you. OAuth2 is the preferred authorization mechanism at Google. That’s mainly because it’s simpler and easier to use than OAuth1 but also because it’s a lot safer than Client Login. In addition, if you’re still using Client Login you should be aware it’s deprecated.

The following video shows what you need to get started with OAuth2 for Ads. It explains what OAuth2 is, how it works, how to use it with our APIs, the different flows of OAuth2 and some best practices. If you just need the client library resources to get started, skip ahead to the Client Libraries section to get all the resources you’ll need to make the switch.



After watching the video you will understand:
  • OAuth2:
    • The Authorization mechanism
  • Better than Client Login:
    • OAuth2 is more secure
    • More specific access control
    • No CAPTCHA challenges
  • Using OAuth2:
    • Registering your application
    • Making the authentication requests
    • Where OAuth2 tokens fit into regular service calls
  • Implementing OAuth2:
  • Authorization Flows:
  • Best Practices:
    • Storing refresh_tokens
With that knowledge, updating your applications to use OAuth2 should be trivial. All the client libraries have comprehensive support for OAuth2 and helpful examples to demonstrate its use. For further information on configuring OAuth2 in any of the libraries, see the table below.

Client Library OAuth2 Resources


Library AdWords / DoubleClick Ad Exchange DoubleClick For Advertisers DoubleClick For Publishers
Java Wiki Page Code Example Wiki Page Code Example Wiki Page Code Example
Python Wiki Page
Code Example
Wiki Page Code Example Wiki Page Code Example
Ruby Wiki Page Code Example
Wiki Page Code Example
Perl Wiki Page Code Example

.Net Wiki Page Code Example Wiki Page Code Example Wiki Page Code Example
PHP Wiki Page Code Example
Wiki Page Code Example


 - , AdWords API Team