Skip to main content

2-Factor Authentication for Django projects

Project description


2-factor SMS authentication for Django projects. Supports Django 3.0.


  1. Add ‘j2fa’ to project settings INSTALLED_APPS
  2. Add j2fa.middleware.Ensure2FactorAuthenticatedMiddleware to project settings MIDDLEWARE (after session middleware)
  3. Make sure resolves to phone number and user.profile.require_2fa resolves to True/False
  4. Set project settings SMS_TOKEN and SMS_SENDER_NAME
  5. Add TwoFactorAuth.as_view() to urls with name=’j2fa-obtain-auth’

Static Code Analysis

The library passes both prospector and mypy checking. To install:

pip install prospector pip install mypy

To analyze:

prospector mypy .

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-j2fa, version 3.6.3
Filename, size File type Python version Upload date Hashes
Filename, size django-j2fa-3.6.3.tar.gz (36.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page