Skip to main content

App connecting django-two-factor-auth and django-social-auth. If user authenticates through social auth, he will be enforced to go through 2FA (if he has it enabled).

Project description

https://badge.fury.io/py/dj-two-factor-social-auth.svg https://codecov.io/gh/PetrDlouhy/dj-two-factor-social-auth/branch/master/graph/badge.svg

App connecting django-two-factor-auth and social-app-django. If user authenticates through social auth, he will be enforced to go through 2FA (if he has 2FA enabled).

Documentation

The full documentation is at https://dj-two-factor-social-auth.readthedocs.io.

Quickstart

We expect, that you have already installed and configured django-two-factor-auth and social-app-django according to their documentation.

Install Django two factor auth for Django social auth:

pip install dj-two-factor-social-auth

Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    "two_factor",
    "social_django",
    "social_2fa",
    ...
)

Add Django two factor auth for Django social auth’s URL patterns:

from django.urls import path


urlpatterns = [
    ...
    path("", include("social_2fa.urls")),
    ...
]

Add social_2fa to your social pipeline in settings.py:

SOCIAL_AUTH_PIPELINE = (
    ...
    "social_2fa.social_pipeline.two_factor_auth",
)

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Development commands

pip install -r requirements_dev.txt
invoke -l

History

1.0.1 (2025-05-19)

  • Fix: session transfer of data

1.0.0 (2025-05-15)

  • Use session to transfer data (safer, more reliable)

  • Update support up to Django 5.2, Python 3.13 versions

  • Drop support for Python 3.8, Django 4.0 and below

0.1.2 (2023-03-09)

0.1.1 (2023-03-08)

  • Update testing and setup.py to support newest Django, Python and django-two-factor-auth

0.1.0 (2022-03-21)

  • First release on PyPI.

Project details


Download files

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

Source Distribution

dj_two_factor_social_auth-1.0.1.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dj_two_factor_social_auth-1.0.1-py2.py3-none-any.whl (8.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file dj_two_factor_social_auth-1.0.1.tar.gz.

File metadata

File hashes

Hashes for dj_two_factor_social_auth-1.0.1.tar.gz
Algorithm Hash digest
SHA256 158ad174009602d56ecb0ea78c9f2a0e24ab4d33d04858479d2020c825d88dd4
MD5 a5208f229f29c120b47206673db7b463
BLAKE2b-256 118fc78bb71e332a6febf0ce4c95911ae28ff43ef4890cd10054f501ed0a9d91

See more details on using hashes here.

File details

Details for the file dj_two_factor_social_auth-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for dj_two_factor_social_auth-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 33cbed474ef3f16842efb5bc424044c408a8439fe9c812b7e3f0ac863ded79e4
MD5 175f0e98cbdf22354f4044d90bb0bc0c
BLAKE2b-256 252b4dfcaef07a9b95c75a5378d129701d157e0da1ba59f33bc1fc67114f4274

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page