django-oauth-toolkit
OAuth2 Provider for Django
What it is and what it does
Django OAuth Toolkit is an OAuth2 provider library that integrates into Django projects to add standards-compliant OAuth2 authorization and token management. It builds on oauthlib to handle RFC-compliant specification and provides pre-built endpoints, data models, and business logic so you don't have to implement OAuth2 from scratch. The package is designed for two main scenarios: protecting your Django REST API with OAuth2 authentication, or running a full OAuth2 authorization server to issue tokens for your infrastructure.
The toolkit handles the core OAuth2 flows and token lifecycle through Django models and views. You configure it by adding the app to INSTALLED_APPS and including its URL patterns, then your Django project becomes an OAuth2 provider. It relies on django, requests, urllib3, oauthlib, and jwcrypto to manage HTTP communication, cryptographic operations, and standards compliance.
Use it for:
- Protect a Django REST API by requiring OAuth2 bearer tokens from client applications.
- Build an OAuth2 authorization server to issue and manage tokens for multiple services in your infrastructure.
- Implement delegated authentication so third-party apps can request access to user data without storing passwords.
- Add token endpoints to a Django application for secure session management.
- Integrate OAuth2 scopes and permissions into Django's permission system for fine-grained access control.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds OAuth2 authorization server capabilities to Django applications, providing endpoints and logic to protect APIs with OAuth2 authentication and manage token issuance.
Yes. The package is actively maintained, production-stable, has no known vulnerabilities, installs with low friction, and solves a well-defined problem—adding OAuth2 provider capabilities to Django. It is RFC-compliant and widely used (top 5000 PyPI packages). Install it if you need to add OAuth2 authentication or token management to a Django application.
Install
django-oauth-toolkit on PyPI
pip
pip install django-oauth-toolkituv
uv add django-oauth-toolkitpoetry
poetry add django-oauth-toolkitInstalling django-oauth-toolkit
Before you install
Low friction installation with a pure-Python wheel. Actively maintained with a release 21 days ago and ongoing repository activity. Depends on well-established packages: django, requests, urllib3, oauthlib, and jwcrypto.
License in practice
BSD license (permissive) allows commercial and private use with minimal restrictions—you must retain copyright notices and disclaimers in distributions.
Quickstart
pip install django-oauth-toolkit
# In settings.py
INSTALLED_APPS = [
...,
'django_oauth_toolkit',
]
# In urls.py
from django_oauth_toolkit import urls
urlpatterns = [
path('o/', include(urls)),
]
Requires Django 4.2, 5.0, 5.1, 5.2 or 6.0; Python 3.10 or later; oauthlib 3.2.2 or later.
Verify before relying
- Whether the package supports custom OAuth2 grant types beyond standard flows.
- Performance characteristics under high token request volume.
- Specific token storage backend options and scalability trade-offs.
- Full scope of token refresh and revocation capabilities.
Package facts
| License | Copyright (c) 2013, Massimiliano Pippi, Federico Frenguelli and contributors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — django, requests, urllib3, oauthlib, jwcrypto |
| Maintenance | actively maintained — 21 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,223,762/month — #2,136 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_oauth_toolkit-3.4.0-py3-none-any.whl
Keywords: django, oauth, oauth2, oauthlib
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
djangorestframework-api-keyProvides API key authentication and permission…
permissive · top 5,000 on PyPI
requests-oauthlibAdds OAuth 1 and OAuth 2 authentication support…
permissive · top 1,000 on PyPI
openfga-sdkPython SDK for OpenFGA that wraps the OpenFGA…
permissive · top 5,000 on PyPI
sanic-jwtSanic JWT adds JWT-based authentication and…
permissive · top 15,000 on PyPI
django-oidc-providerProvides OpenID Connect and OAuth 2.0 server…
permissive · top 15,000 on PyPI
django-scim2Implements the SCIM 2.0 provider specification…
permissive · top 5,000 on PyPI
Flask-OAuthlibFlask-OAuthlib adds OAuth 1.0a and OAuth 2.0…
permissive · top 15,000 on PyPI
requests-authAdds OAuth2, API key, Basic, and NTLM…
permissive · top 15,000 on PyPI
oauth2-clientHandles OAuth2 authentication flows…
unclear · top 15,000 on PyPI
h2o-authnProvides OAuth 2.0 token management for H2O…
permissive · top 15,000 on PyPI