Skip to main content

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

Project description

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

https://img.shields.io/pypi/v/django-oauthost.svg https://img.shields.io/pypi/l/django-oauthost.svg https://img.shields.io/coveralls/idlesign/django-oauthost/master.svg

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!

Documentation

http://django-oauthost.readthedocs.org/

Project details


Download files

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

Source Distribution

django-oauthost-1.1.1.tar.gz (45.7 kB view details)

Uploaded Source

Built Distribution

django_oauthost-1.1.1-py2.py3-none-any.whl (65.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-oauthost-1.1.1.tar.gz.

File metadata

  • Download URL: django-oauthost-1.1.1.tar.gz
  • Upload date:
  • Size: 45.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for django-oauthost-1.1.1.tar.gz
Algorithm Hash digest
SHA256 4ffa2404a959e1b102996f857424b67fac85f6177d6ae32010ee74718ce3b83a
MD5 5c5599f8f1ad37a8f77ff0f95e754c47
BLAKE2b-256 f2a428192612185af0ad0d12694f8ab849e56286f09afacdd60f6990ef6b68d3

See more details on using hashes here.

File details

Details for the file django_oauthost-1.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_oauthost-1.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2ea7926d3f5c3451d0a8787874b737ea81a69a89bb0ae68f23acb5df98716fbe
MD5 c73b684a397cf4633e8308d8c08dcab5
BLAKE2b-256 69c5faed57b9b8203c1df557d4f82183e9129d911a24e55af567ac17d90bbaca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page