Install the Package
Install django-allauth with the headless extra:Configure Django Settings
Add the required apps to yourINSTALLED_APPS in settings.py:
Configure Authentication Backend
Ensure the allauth authentication backend is configured:Configure Middleware
Add the required middleware:Configure Frontend URLs
Define the URLs for your frontend application. These are used in emails for verification and password reset:URL Placeholders
The{key} placeholder is automatically replaced with the actual verification or reset key. You can customize the URL structure:
Configure URL Patterns
Add the headless API endpoints to your project’surls.py:
/_allauth/browser/v1/ (for browser clients) and /_allauth/app/v1/ (for app clients).
Basic Account Settings
Configure basic account behavior:Headless-Only Mode (Optional)
If your app is fully headless and you don’t need the traditional django-allauth views:Run Migrations
Apply the database migrations:Development Setup
For local development, you might want to:Use Console Email Backend
View emails in the console instead of sending them:Allow Localhost
Add localhost to allowed hosts:Configure Frontend URLs for Local Development
Verify Installation
Start your Django development server:Next Steps
- Configure authentication settings including JWT tokens
- Set up CORS for cross-origin requests
- Learn about authentication flows
- Explore the OpenAPI specification at
/_allauth/openapi.html(requiresdjango-allauth[headless-spec])
Common Issues
Missing Middleware Error
If you seeallauth.account.middleware.AccountMiddleware must be added to settings.MIDDLEWARE, add it to your middleware list.
