django-allauth

Configure django-allauth headless authentication with MFA and REST endpoints.

2|Updated Nov 19, 2025
One-click install
npx skills add https://github.com/otoshek/Claude-Code-Toolkit --skill django-allauth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: django-allauth
Source: https://github.com/otoshek/Claude-Code-Toolkit/tree/main/skills/django-allauth
Command: npx skills add https://github.com/otoshek/Claude-Code-Toolkit --skill django-allauth

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pytest, pytest-django, pytest-asyncio, django-ninja, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill configures django-allauth in headless mode with MFA, social authentication, CORS, and REST endpoints, enabling secure, SPA-friendly authentication for React/Vue frontends.

Core Features & Use Cases

  • Install and configure django-allauth with headless API, MFA (TOTP, WebAuthn, recovery codes), and social login support.
  • Enable CORS/CSRF for a separate HTTPS frontend and provide HEADLESS_FRONTEND_URL redirects for flows.
  • Expose REST endpoints under /accounts/ and /_allauth/ for frontend integration.
  • Provide a validation harness to run the official headless allauth tests and guidance for troubleshooting.

Quick Start

Set up the Django project, environment, URLs, migrations, and then validate with the headless tests.

Frequently Asked Questions about django-allauth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up headless authentication for a Django backend serving a React or Vue frontend?

Headless authentication configures Django to expose REST API endpoints instead of server-rendered pages, letting SPAs handle UI. django-allauth provides /accounts/ and /_allauth/ endpoints for login, registration, MFA, and social OAuth flows without page redirects, enabling secure token-based auth for separate frontends.

Can I add multi-factor authentication and social login to my Django API?

Yes. django-allauth supports TOTP, WebAuthn, and recovery codes for MFA, plus built-in OAuth providers like Google. The headless setup exposes these as REST endpoints, letting you validate credentials and issue tokens from your API layer.

How do I handle CORS and session management between a Django backend and a separate frontend domain?

Configure HEADLESS_FRONTEND_URL to define your SPA domain, enable CORS middleware, and adjust CSRF settings for cross-origin requests. django-allauth then routes post-auth redirects to your frontend and supports both session and JWT authentication modes.

What's the difference between django-allauth's traditional and headless modes?

Traditional mode renders auth pages server-side; headless mode exposes REST endpoints and omits HTML templates, letting your SPA or mobile app own the UI. Headless is required for decoupled React/Vue frontends and mobile clients that need JSON responses.

Do I need to modify settings.py and URL routing to enable django-allauth's MFA and social login?

Yes. You install django-allauth, add it to INSTALLED_APPS, configure MFA providers and OAuth credentials in settings.py, include allauth URLs under /accounts/ and /_allauth/, run migrations, then validate with the provided headless test harness.

What are the limitations of using django-allauth in headless mode with WebAuthn?

WebAuthn requires HTTPS and browser support; deployment must use proper SSL certificates. Session and JWT token lifetimes, middleware ordering, and environment variable loading affect security and need careful configuration to avoid auth flow breaks.