Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using allauth-2fa without socialauth installed it fails with error #203

Open
darklow opened this issue Jan 15, 2025 · 3 comments
Open

Comments

@darklow
Copy link

darklow commented Jan 15, 2025

Installed apps have following apps installed:

# django-allauth==65.3.1
# django-allauth-2fa==0.11.1

INSTALLED_APPS = [
...
    'allauth',
    'allauth.account',
    'allauth_2fa',
]

When importing OTPAdapter it throws following exception.

./manage.py shell
Python 3.11.5 (main, Nov 21 2024, 22:26:00) [Clang 16.0.0 (clang-1600.0.26.4)] on darwin

>>> from allauth_2fa.adapter import OTPAdapter

/Users/user/project/.venv/lib/python3.11/site-packages/allauth/exceptions.py:9: UserWarning: allauth.exceptions is deprecated, use allauth.core.exceptions
  warnings.warn("allauth.exceptions is deprecated, use allauth.core.exceptions")
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/user/project/.venv/lib/python3.11/site-packages/allauth_2fa/adapter.py", line 7, in <module>
    from allauth.socialaccount.models import SocialLogin
  File "/Users/user/project/.venv/lib/python3.11/site-packages/allauth/socialaccount/models.py", line 26, in <module>
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: allauth.socialaccount not installed, yet its models are imported.

But socialauth should be optional unless it is really required.

@akx
Copy link
Member

akx commented Jan 15, 2025

django-allauth has built-in support for MFA since version 0.56.0 or thereabouts. See #189.

You shouldn't use django-allauth-2fa with these newer versions of django-allauth; just use allauth.mfa. This will be documented via #204.

@darklow
Copy link
Author

darklow commented Jan 15, 2025

Thanks, wasn't aware.
Although it works completely fine with newest allauth too, just this one import issue.

@akx
Copy link
Member

akx commented Jan 15, 2025

Huh. Well, our tests certainly didn't work with newer versions once upon a time: #194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants