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:
Google APIs Client Libraries for Java, Objective-C, PHP, Python, Ruby, JavaScript
Facebook SDKs for JavaScript, Android, iOS, PHP
Foursquare does not provide official libraries, but it links to many community-contributed libraries, many of which support 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': ...