Skip to main content

django-oauthost

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

release lic coverage

What's that

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

Use it when you want your site to issue access tokens. Note that oauthost is an OAuth server, not a client — it can not sign your users in via external providers (see django-sitegate for that).

Available scenarios:

  • Open your API to third-party applications ("Sign in with YourSite").
  • Let your own mobile/SPA app talk to your Django backend.
  • Protect your views with tokens instead of sessions.
  • Serve separate resource servers via token introspection (RFC 7662).
  • Guard your Django REST framework API out of the box (authentication, scope permissions, OpenAPI schema).

See usage scenarios with diagrams: https://django-oauthost.readthedocs.io/

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

https://django-oauthost.readthedocs.io/

Metadata

Release files for django-oauthost 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-oauthost 1.3.0
File Size Uploaded Provenance Actions
django_oauthost-1.3.0.tar.gz 29.6 kB Without provenance Details for django_oauthost-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-oauthost 1.3.0
File Interpreter ABI Platform Actions
django_oauthost-1.3.0-py3-none-any.whl Python 3 none any Details for django_oauthost-1.3.0-py3-none-any.whl

Total release size: 73.4 kB

Release files / django_oauthost-1.3.0.tar.gz

Download URL django_oauthost-1.3.0.tar.gz
Size 29.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5ae478bb6effc63c0878d02824a708ac875f547c875e0e91bf0ee03e7ccfdac1
BLAKE2b-256 checksum
How to use checksums
398071dae3fee8094545814e0e7031c29fd955c5f227fd7a5597daad76fa5a93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / django_oauthost-1.3.0-py3-none-any.whl

Download URL django_oauthost-1.3.0-py3-none-any.whl
Size 43.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3505d23ce8a5f97e673ac81dc1f1daa8a40ea5539eb316d218f0aab99d17d0c7
BLAKE2b-256 checksum
How to use checksums
fc609ccb090dbd79ae3cd80feae53d4d0f5e0d9860066be35c0ac18eeb148195
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for django-oauthost 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page