Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Reusable application for Django to protect your apps with OAuth 2.0.

Project description

http://github.com/idlesign/django-oauthost

https://landscape.io/github/idlesign/django-oauthost/master/landscape.svg?style=flat

What’s that

Reusable application for Django to protect your apps with OAuth 2.0.

It allows to guard your application views with OAuth 2.0 in quite a trivial way.

  1. Register your client using Django Admin or API:
from oauthost.toolbox import register_client

...

# Define some scopes to restrict our client to (if required).
my_scopes = ['polls:vote']

# `user` might be `request.user` if in a view.
register_client('My OAuth Client', 'my_client',
                'http://someurl.com/myclient/', user, scopes_list=my_scopes)

...
  1. Decorate your views with oauth_required (suppose in polls.views):
from oauthost.decorators import oauth_required

@oauth_required(scope_auto=True)
def vote(request, poll_id, variant_id):
    ...
  1. Attach oauthost.urls to project urls (in urls.py):
from oauthost.urls import urlpatterns as oauthost_urlpatterns

urlpatterns = ...  # Your actual urlpatterns are ommited.

urlpatterns += oauthost_urlpatterns

Now authorization endpoint is available at { BASE_URL }auth/ and token endpoint is available at { BASE_URL }token/.

That’s all for oauthost, connect using your client.

More information is available, read the docs!

Project details


Release history Release notifications

This version
History Node

0.5.0

History Node

0.4.0

History Node

0.3.0

History Node

0.2.0

History Node

0.1.0

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django_oauthost-0.5.0-py2.py3-none-any.whl (65.1 kB) Copy SHA256 hash SHA256 Wheel 2.7 Dec 16, 2017
django-oauthost-0.5.0.tar.gz (47.4 kB) Copy SHA256 hash SHA256 Source None Dec 16, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page