REST Framework OAuth
OAuth support for Django REST Framework
Overview
OAuth support extracted as a third party package directly from the official Django REST Framework implementation. It's built to use the django-oauth-plus, oauth2, and django-oauth2-provider packages.
This package provides two authentication classes, OAuthAuthentication and OAuth2Authentication, and a TokenHasReadWriteScope permission class.
Requirements
- Python 2.7
- Django (1.6, 1.7)
- Django REST Framework (2.4.3, 2.4.4, 3.0-beta)
Installation
Install using pip
:
$ pip install djangorestframework-oauth
OAuth packages are optional and not installed out of the box. Use of OAuthAuthentication
requires installation of the django-oauth-plus
and oauth2
packages:
$ pip install django-oauth-plus oauth2
Use of OAuth2Authentication
requires installation of django-oauth2-provider
:
$ pip install django-oauth2-provider
Use of TokenHasReadWriteScope
requires installation of either django-oauth-plus
or django-oauth2-provider
.
Documentation & Support
Full documentation for the project is available at http://jpadilla.github.io/django-rest-framework-oauth/.
You may also want to follow the author on Twitter.
Testing
Install testing requirements.
$ pip install -r requirements.txt
Run with runtests.
$ ./runtests.py
You can also use the excellent tox testing tool to run the tests against all supported versions of Python and Django. Install tox globally, and then simply run:
$ tox
Documentation
To build the documentation, you'll need to install mkdocs
.
$ pip install mkdocs
To preview the documentation:
$ mkdocs serve
Running at: http://127.0.0.1:8000/
To build the documentation:
$ mkdocs build