Reusable application for Django to protect your apps with OAuth 2.0.
Project description
http://github.com/idlesign/django-oauthost
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.
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)
...
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):
...
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_oauthost-0.5.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f9adabb366e8e152240b8d6257d81662923ad8b9234aae140b5c2f5365bb77b |
|
MD5 | 732b8e2b2fe679be619ed9b740f651b1 |
|
BLAKE2b-256 | 5a24c48ab8fdd384a7fc9df836b1bbc06c83b02eb0a90974d7fec03ed916b903 |