mozilla-django-oidc
A lightweight authentication and access management library for integration with OpenID Connect enabled authentication services.
What it is and what it does
mozilla-django-oidc is a lightweight Django authentication backend that connects your application to OpenID Connect identity providers. It handles the OIDC authorization code flow to authenticate users against external identity services, storing minimal authentication artifacts in your Django session. The library is designed around simplicity and security: it supports custom authentication backend overrides for site-specific logic, has been audited by Mozilla InfoSec, and targets modern Django versions (4.2 through 5.2) with Python 3.10+.
The package depends on Django, pyjwt, requests, and cryptography to manage JWT token validation, HTTP communication with the OIDC provider, and cryptographic operations. It is primarily used to offload user authentication to a centralized identity provider—useful for single sign-on scenarios, federated authentication, or integration with Mozilla's own authentication infrastructure.
Use it for:
- Integrate a Django application with a corporate or institutional OpenID Connect provider for centralized user authentication.
- Implement single sign-on (SSO) across multiple Django applications using a shared OIDC identity provider.
- Delegate user authentication to an external identity service while maintaining custom authorization logic in Django.
- Add Mozilla-specific authentication and authorization features to a Django application.
- Build a multi-tenant Django application where each tenant connects to its own OIDC provider.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Integrates Django applications with OpenID Connect identity providers to handle authentication and authorization through OIDC-enabled services.
Yes, with conditions. The package is production-stable, widely used (1.1M monthly downloads), audited by Mozilla InfoSec, and has no known vulnerabilities. However, maintenance is aging (238 days since last release); verify that Django 5.2 compatibility is current for your version before adopting. If you need OIDC authentication in Django and can accept the MPL-2.0 copyleft license, this is a solid choice.
Install
mozilla-django-oidc on PyPI
pip
pip install mozilla-django-oidcuv
uv add mozilla-django-oidcpoetry
poetry add mozilla-django-oidcInstalling mozilla-django-oidc
Before you install
Low install friction with a pure-Python wheel distribution. Maintenance status is aging—last release was 238 days ago—but the repository remains active with a recent commit on 2026-01-07 and no archived status.
License in practice
Licensed under MPL-2.0 (copyleft). You must disclose source code modifications and distribute under the same license if you modify and redistribute the package, but can use it in proprietary applications without distributing the library itself.
Quickstart
pip install mozilla-django-oidc
from mozilla_django_oidc.auth import OIDCAuthenticationBackend
# Add to Django AUTHENTICATION_BACKENDS
AUTHENTICATION_BACKENDS = [
'mozilla_django_oidc.auth.OIDCAuthenticationBackend',
]
Requires Django 4.2 or later and Python 3.10 or later; OIDC provider endpoint must be configured in Django settings.
Verify before relying
- Whether the package supports OIDC implicit flow or only authorization code flow as stated in design principles.
- Current compatibility with Django 5.2 given the aging maintenance status and 238-day release gap.
- Whether custom backend overrides are documented with examples for common use cases.
Package facts
| License | MPL-2.0 (copyleft) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — Django, pyjwt, requests, cryptography |
| Maintenance | aging — 238 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,143,073/month — #4,303 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: mozilla_django_oidc-5.0.2-py3-none-any.whl
Keywords: mozilla-django-oidc
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
django-oidc-providerProvides OpenID Connect and OAuth 2.0 server…
permissive · top 15,000 on PyPI
flask-oidcAdds OpenID Connect authentication support to…
permissive · top 5,000 on PyPI
pyopImplements an OpenID Connect Provider (OP)…
permissive · top 15,000 on PyPI
oidc-provider-mockA mock OpenID Connect provider server that runs…
permissive · top 15,000 on PyPI
oicA complete Python implementation of OpenID…
permissive · top 15,000 on PyPI
dash-authAdds HTTP Basic Authentication and OpenID…
permissive · top 15,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
PyLTI1p3Implements the LTI 1.3 Advantage specification…
permissive · top 15,000 on PyPI
python-keycloakProvides Python bindings to the Keycloak API,…
permissive · top 5,000 on PyPI
stups-zignZign is a command-line utility for OAuth2 token…
permissive · top 15,000 on PyPI