OAuth v2 (Draft 20) implementation in Python (web2py framework)
Python Perl
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
controllers
languages
models
modules
views
.gitignore
ABOUT
LICENSE
README.md
__init__.py

README.md

web2py-oauth2

An OAuth 2.0 module for web2py framework, based in:

Requirements

  • Python

Using

From web2py\applications, clone the app git clone https://github.com/SamuelMarks/web2py-oauth2.git oauth2

Then follow these steps to test the module:

  • Add a client (http://your_server[:port]/application/add_client)
  • Change the client_id, client_secret and redirect_uri at controllers/callback.py for the ones given by the above step
  • Browse http://your_server[:port]/application/auth with the required parameters and click "Yes"
  • Get the access_token and refresh_token
  • curl -H "Authorization: Bearer access_token_here" http://your_server[:port]/application/protected_resource

Contributing

Want to contribute? Great! Just fork this project and/or make a pull request ;)

TODO

  • Unit tests
  • Upgrade from Draft 20 to released OAuth2 standards

NOTE

This code was originally written by João Alves and Tiago Pereira and after that was changed by Samuel Marks

The major changes that Samuel did in the code can be summarised in three points:

  1. Reviewed the entire codebase; improving quality, fixing hacks and improving formatting along the way.
  2. Rewrote all the relevant exceptions to use gluon.http.HTTP (with correct HTTP error codes + easier to understand specific exception messages)
  3. Implemented subclasses of OAuthStorage for web2py's DAL. Now this project is no longer locked-into MongoDB ;]