django-allauth-2fa
Adds two factor authentication to django-allauth
What it is and what it does
django-allauth-2fa is a Django application that backports two-factor authentication to older versions of django-allauth (before 0.58.0). It integrates with django-allauth's authentication and account management system to add a second verification layer, supporting both time-based authenticator apps (displayed via QR code) and single-use backup codes for account recovery. The package depends on django-allauth, django-otp for OTP handling, Django itself, and qrcode for QR code generation.
The package is explicitly intended as a stopgap for projects stuck on older django-allauth versions. If you are using django-allauth 0.56.0 or newer, the project's maintainers recommend using django-allauth's built-in MFA support instead. The package maintains compatibility with Django 4.1–4.2 and Python 3.8–3.11, and is actively maintained but in a limited capacity given its deprecated status for newer allauth versions.
Use it for:
- Add 2FA to a Django project using django-allauth < 0.58.0 without upgrading allauth.
- Provide users with authenticator app support (TOTP) via QR code enrollment.
- Generate and manage single-use backup codes for account recovery in case of lost authenticator.
- Extend django-allauth's authentication workflow with a second verification factor for security-sensitive applications.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Adds two-factor authentication to django-allauth versions older than 0.58.0, supporting authenticator apps via QR code and single-use backup codes.
Yes, if you are locked on django-allauth < 0.58.0 and need 2FA now. Low install friction, active maintenance, and no known vulnerabilities. However, strongly prefer upgrading to django-allauth 0.58.0+ and using its built-in MFA support if your project timeline allows—this package is a temporary bridge, not a long-term solution.
Install
django-allauth-2fa on PyPI
pip
pip install django-allauth-2fauv
uv add django-allauth-2fapoetry
poetry add django-allauth-2faInstalling django-allauth-2fa
Before you install
Low install friction with a pure Python wheel. Actively maintained as of July 2026 with 218 repository stars. Note: the package is explicitly deprecated for django-allauth versions 0.58.0 and newer, which have built-in MFA support—verify your django-allauth version before installing.
License in practice
Licensed under Apache Software License (permissive). No restrictions on commercial or private use.
Quickstart
pip install django-allauth-2fa
from django_allauth_2fa.views import setup_2fa
# Add to Django urlpatterns and configure django-allauth, django-otp, and qrcode in settings
Requires django-allauth < 0.58.0; incompatible with newer versions that have built-in MFA. Requires Django 4.1 or 4.2 and Python 3.8–3.11 per documented compatibility matrix.
Verify before relying
- Whether the package works with Python versions beyond 3.11 or Django versions beyond 4.2.
- Current maintenance cadence and response time for bug reports or security issues.
- Whether the QR code generation and backup code workflows are production-ready for all use cases.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — django-allauth, django-otp, django, qrcode |
| Maintenance | actively maintained — 575 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 91,283/month — #13,529 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_allauth_2fa-0.12.0-py3-none-any.whl
Keywords: 2fa, allauth, auth, authentication, django, factor, otp, two
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
django-otpAdds one-time password (OTP) support to Django…
permissive · top 5,000 on PyPI
django-two-factor-authAdds complete two-factor authentication to…
permissive · top 5,000 on PyPI
dj-rest-authProvides drop-in REST API endpoints for user…
permissive · top 5,000 on PyPI
django-allauthProvides integrated local and social…
permissive · top 5,000 on PyPI
google-reauthProvides two-factor authentication reauth…
permissive · top 5,000 on PyPI
authyPython client for the Twilio Authy two-factor…
permissive · top 15,000 on PyPI
django-invitationsProvides a generic invitation system for Django…
copyleft · top 15,000 on PyPI
duo-clientPython client library for Duo Security's…
permissive · top 15,000 on PyPI
PyOTPPyOTP generates and verifies one-time passwords…
permissive · top 1,000 on PyPI
pyu2fpyu2f provides U2F (Universal 2nd Factor)…
permissive · top 15,000 on PyPI