Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsMay 24, 2026·3 min de lecture

django-allauth — Comprehensive Authentication for Django

A battle-tested Django library providing local account registration, social login with 80+ providers, multi-factor authentication, and account management out of the box.

Prêt pour agents

Cet actif peut être lu et installé directement par les agents

TokRepo expose une commande CLI universelle, un contrat d'installation, le metadata JSON, un plan selon l'adaptateur et le contenu raw pour aider les agents à juger l'adaptation, le risque et les prochaines actions.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
django-allauth Overview
Commande CLI universelle
npx tokrepo install d9d1f4e0-578c-11f1-9bc6-00163e2b0d79

Introduction

django-allauth is the most widely adopted authentication solution for Django projects. It handles the full lifecycle of user accounts including email verification, password reset, social login, and multi-factor authentication, eliminating the need to build these security-critical features from scratch.

What django-allauth Does

  • Manages local account registration with email verification and password policies
  • Integrates 80+ social authentication providers (Google, GitHub, Apple, SAML, OpenID Connect)
  • Supports multi-factor authentication via TOTP authenticator apps and recovery codes
  • Handles account linking when users sign in with multiple providers
  • Provides a headless API mode for single-page applications and mobile clients

Architecture Overview

django-allauth plugs into Django's authentication framework as a custom backend. It uses an adapter pattern to customize behavior (e.g., auto-signup, email verification flow). Social providers are configured via Django admin or settings, and OAuth flows are handled through callback views. The headless mode exposes JSON endpoints for frontend frameworks.

Self-Hosting & Configuration

  • Install via pip and add to INSTALLED_APPS with account and socialaccount modules
  • Run migrations: python manage.py migrate
  • Configure providers in Django admin under Social Applications (client ID, secret, callback URL)
  • Set ACCOUNT_EMAIL_VERIFICATION, ACCOUNT_AUTHENTICATION_METHOD, and login redirect URLs
  • Enable MFA by adding allauth.mfa to INSTALLED_APPS

Key Features

  • 80+ social providers including OAuth2, OpenID Connect, SAML, and enterprise SSO
  • Headless mode provides JSON API for React, Vue, mobile apps without server-rendered templates
  • Multi-factor authentication with TOTP and WebAuthn passkey support
  • Account linking and disconnecting across multiple social identities
  • Extensible adapter system for customizing signup, login, and account management logic

Comparison with Similar Tools

  • Django built-in auth — only provides password-based login; allauth adds social login, email verification, MFA
  • django-social-auth (social-auth-app-django) — social login only; allauth combines local + social + MFA in one package
  • Auth.js (NextAuth) — similar multi-provider auth for Node.js; allauth is the Django equivalent
  • django-rest-auth / dj-rest-auth — REST API wrappers that often use allauth as backend for actual auth logic

FAQ

Q: Can I use django-allauth with Django REST Framework? A: Yes. Enable headless mode (HEADLESS_ONLY=True) for pure API usage, or pair with dj-rest-auth which wraps allauth endpoints.

Q: How do I add a new social provider? A: Install allauth, add the provider to INSTALLED_APPS, then create a Social Application in Django admin with your OAuth client credentials.

Q: Does it support passwordless login? A: Yes. Configure ACCOUNT_LOGIN_BY_CODE_ENABLED for email-based one-time codes, or use WebAuthn passkeys via the MFA module.

Q: Is django-allauth suitable for multi-tenant applications? A: Yes. Use Django sites framework or custom adapters to scope providers and settings per tenant.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires