An OAuth 2.0 module for web2py framework, based in:
- Python
- MongoDB
- PyMongo
I have tested with Python 2.7, MongoDB 2.0.7 and pymongo 2.2.1, but it should work properly with other versions. NOTE: The OAuthStorage class is extensible, so you can work with DAL if you implement it.
It's just like any other web2py application. Here are a few steps to test the module:
- Add a client (
http://your_server[:port]/application/add_client
) - Change the
client_id
,client_secret
andredirect_uri
atcontrollers/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
andrefresh_token
curl -H "Authorization: Bearer access_token_here" http://your_server[:port]/application/protected_resource
Want to contribute? Great! Just fork this project and/or make a pull request ;)
- Implement subclasses of OAuthStorage for the web2py's Database Abstraction Layer
- Unit tests
- Improve the code and the comments
By default, the web2py-oauth2 module works with web2py framework and MongoDB but is easy to adapt it to another frameworks and databases