Skip to Content
Getting Started with OAuth 2.0
book

Getting Started with OAuth 2.0

by Ryan Boyd
February 2012
Beginner to intermediate
78 pages
2h 13m
English
O'Reilly Media, Inc.
Content preview from Getting Started with OAuth 2.0

Libraries

Many major API providers build and maintain client libraries for accessing their specific services. Some of these libraries, such as the Google API Clients and Facebook SDKs provide built-in support for OAuth 2.0. When OAuth support is provided, these libraries often abstract the implementations enough to make it really easy to implement.

Here are some API-specific client libraries which implement OAuth 2.0:

Some of these libraries make it trivially easy to implement OAuth 2.0. Here’s an example using Google’s Python library on App Engine with the library’s decorator pattern. This example requires only a few lines of OAuth-specific code:

from oauth2client.appengine import OAuth2Decorator ... decorator = OAuth2Decorator( client_id='CLIENT_ID_FROM_DAILYMOTION', client_secret='CLIENT_SECRET_FROM_DAILYMOTION', scope='read', auth_uri='https://api.dailymotion.com/oauth/authorize', token_uri='https://api.dailymotion.com/oauth/token' ) class MainHandler(webapp.RequestHandler): @decorator.oauth_required def get(self): http = decorator.http() resp, content = http.request('https://api.dailymotion.com/me') path = os.path.join(os.path.dirname(__file__), 'welcome.html') logout = users.create_logout_url('/') variables = { 'content': ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

OAuth 2 in Action

OAuth 2 in Action

Justin Richer, Antonio Sanso

Publisher Resources

ISBN: 9781449317843Errata PageSupplemental Content