django-authlib
Authentication utils for Django
What it is and what it does
django-authlib is a lightweight Django authentication library that replaces password-based login with passwordless alternatives. It supports two main flows: sending cryptographically signed email links for registration and login, or delegating authentication to OAuth2 providers (Google, Microsoft, Facebook, Twitter). The library is intentionally minimal—it provides authentication backends and optional bundled views rather than imposing a full framework, allowing developers to integrate it into existing Django projects with minimal configuration.
The package includes an optional admin OAuth module for restricting Django admin access to users from specific email domains, and a basic user model (little_auth) for projects that don't have a custom user implementation. It relies on requests-oauthlib for OAuth handling and integrates with Django's authentication system via the EmailBackend. Setup requires adding the backend to AUTHENTICATION_BACKENDS and optionally including the app in INSTALLED_APPS for translation support.
Use it for:
- Add OAuth2 social login (Google, Microsoft, Facebook, Twitter) to a Django site without building OAuth flows from scratch.
- Implement email-based passwordless registration where users receive signed links instead of setting passwords.
- Restrict Django admin access to users from a specific email domain using OAuth2 credentials.
- Replace traditional password authentication in a Django app with email-link-based login for improved security.
- Integrate a lightweight user model with email-as-username for projects without a custom user implementation.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides passwordless authentication for Django using email-based links or OAuth2 from Google, Microsoft, Facebook, and Twitter.
Yes. The package is actively maintained, has no known vulnerabilities, installs with minimal friction, and solves a real problem (passwordless authentication) in a deliberately lightweight way. It's suitable for Django projects of any size that want OAuth2 or email-based login without heavy dependencies. The MIT license poses no restrictions.
Install
django-authlib on PyPI
pip
pip install django-authlibuv
uv add django-authlibpoetry
poetry add django-authlibInstalling django-authlib
Before you install
Low install friction with a single runtime dependency (requests-oauthlib). Active maintenance with a recent release 43 days ago and ongoing commits.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.
Quickstart
pip install django-authlib
In settings.py:
AUTHENTICATION_BACKENDS = ['authlib.backends.EmailBackend']
INSTALLED_APPS = [..., 'authlib']
from authlib.google import GoogleOAuth2Client
from authlib import views
# Use views.oauth2 with GoogleOAuth2Client for OAuth login
Requires Django project setup; OAuth providers need client credentials (GOOGLE_CLIENT_ID, etc.) configured in settings; OAUTHLIB_INSECURE_TRANSPORT must be set for development without HTTPS.
Verify before relying
- Whether the package supports Django versions beyond those implied by the Python 3.9+ requirement.
- Performance characteristics when handling high-volume email-based authentication flows.
- Current state of documentation beyond the README excerpt provided.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — requests-oauthlib |
| Maintenance | actively maintained — 43 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 96,102/month — #13,230 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_authlib-0.18.0-py3-none-any.whl
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
django-allauthProvides integrated local and social…
permissive · top 5,000 on PyPI
django-google-ssoAdds Google OAuth 2.0 authentication to Django…
permissive · top 15,000 on PyPI
django-magiclinkAdds passwordless email-based authentication to…
permissive · top 15,000 on PyPI
django-sesamedjango-sesame provides token-based…
permissive · top 15,000 on PyPI
stytchA Python client library for integrating…
permissive · top 5,000 on PyPI
django-auth-ldapProvides a Django authentication backend that…
permissive · top 15,000 on PyPI
django-auth-adfsIntegrates Django applications with Microsoft…
permissive · top 15,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
django-otp-webauthnAdds WebAuthn Passkey support to Django OTP,…
permissive · top 15,000 on PyPI
webauthnImplements server-side WebAuthn validation for…
permissive · top 5,000 on PyPI