Sign up ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

Code Snippet

from sanction.client import Client
from import Google

client = Client(Google, {
    "google.client_id": "myclientid",
    "google.client_secret": "myclientsecret",
    "google.redirect_uri": "myredirecturi",
    "google.scope": "myscope",
    "google.access_type": "online" # google-specific

# get authorization

# returned to your app (subsequent request)

# if all goes well in previous call


Note: Sanction is nearing alpha state, so usage and issue logs are appreciated.

Sanction is a Python implementation of the OAuth 2.0 protocol. It was written to cover issues missed by other implementations:

  • Support for multiple providers (protocol deviations). This didn't seem to be supported by any library.
  • Actually an OAuth2 implementation (python-oauth2 is a 2nd version of python-oauth, not an actual OAuth2 implementation)
  • Support for the entire OAuth2 spec. Most provide support for the authorization request flow (employed by all web server providers) with Bearer token credentials, but lacked support or extensibility for any other flows, credentials or other provider extensions)
  • 100% unit test coverage. Some employed TDD, others didn't.

The library is for anyone wanting to access protected resources via OAuth 2.0.

Currently, there are implementations for:

  • Google
  • Facebook
  • Foursquare
  • Deviant Art
  • Stack Exchange






Demian Brecht <demianbrecht [at]>


Contributions can be made through pull requests.

share|improve this question
@Oli: Thanks, updated. –  Demian Brecht Jan 4 '13 at 0:16

2 Answers 2

FWIW, this library has undergone a major overhaul and now lives as a much happier Pythonic module (went from ~450 LOC to 66) and can be found at

share|improve this answer

...And now also supports Python 3 (Github version, not uploaded to PyPI yet).

share|improve this answer

You must log in to answer this question.

protected by Community Oct 5 at 17:25

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .