Issues and manages OAuth2 tokens inside an existing Django site. Can protect Django or Django REST Framework APIs as a resource server using OAuthLib.
Overview
Django OAuth Toolkit is an OAuth 2.0 authorization server for teams already running Django. It exposes endpoints, models, and logic to grant and maintain tokens from the same project instead of operating a separate auth service.
As an authorization server it wires into Django URL configuration under a conventional path prefix after adding the oauth2 provider app. It can also act as a resource server to guard APIs with OAuth2 access tokens. Behavior leans on OAuthLib for RFC-aligned flows.
Recent releases add Model Context Protocol authorization server expectations by default, including required PKCE, authorization server metadata (RFC 8414), and protected resource metadata (RFC 9728) discovery endpoints in the default URL set. Dynamic Client Registration and Client ID Metadata Documents are optional via settings.
Documentation covers grants such as authorization code and client credentials, Django REST Framework and Django Ninja integration, OpenID Connect, pushed authorization requests, device flows, admin management of applications and tokens, and separation of authorization and resource servers when APIs run on another Django instance.
Key features
- OAuth 2.0 authorization server
- API resource server mode
- OAuthLib RFC compliance
- PKCE by default
- MCP authorization support
- Metadata discovery endpoints
- Optional dynamic client registration
- Django REST Framework integration
Use cases
- OAuth for Django APIs
- Single-project token issuance
- MCP authorization backends
- Third-party app access control