Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/idlesign/django-oauthost
Reusable application for Django, introducing OAuth2 server functionality.
https://github.com/idlesign/django-oauthost
authentication authorization django oauth2 python
Last synced: 2 months ago
JSON representation
Reusable application for Django, introducing OAuth2 server functionality.
- Host: GitHub
- URL: https://github.com/idlesign/django-oauthost
- Owner: idlesign
- License: bsd-3-clause
- Created: 2011-11-06T14:47:51.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2022-02-04T12:50:22.000Z (almost 3 years ago)
- Last Synced: 2024-10-29T23:23:32.631Z (2 months ago)
- Topics: authentication, authorization, django, oauth2, python
- Language: Python
- Homepage: https://github.com/idlesign/django-oauthost
- Size: 166 KB
- Stars: 25
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
- starred-awesome - django-oauthost - Reusable application for Django, introducing OAuth2 server functionality. (Python)
README
django-oauthost
===============
http://github.com/idlesign/django-oauthost.. image:: https://img.shields.io/pypi/v/django-oauthost.svg
:target: https://pypi.python.org/pypi/django-oauthost.. image:: https://img.shields.io/pypi/l/django-oauthost.svg
:target: https://pypi.python.org/pypi/django-oauthost.. image:: https://img.shields.io/coveralls/idlesign/django-oauthost/master.svg
:target: https://coveralls.io/r/idlesign/django-oauthostWhat'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:
.. code-block:: python
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)...
2. Decorate your views with `oauth_required` (suppose in `polls.views`):
.. code-block:: python
from oauthost.decorators import oauth_required
@oauth_required(scope_auto=True)
def vote(request, poll_id, variant_id):
...3. Attach `oauthost.urls` to project `urls` (in `urls.py`):
.. code-block:: python
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/