Authentication and Registration in Django Rest Framework
Maintained. Last release 9 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity.
pip install dj-rest-authdj-rest-auth
Secure drop-in authentication endpoints for Django REST Framework. Works seamlessly with SPAs and mobile apps.
Features
- Login, logout, password change, password reset
- User registration with email verification
- Built-in MFA/2FA support (TOTP + recovery codes)
- JWT authentication with HTTP-only cookies
- Social auth (Google, GitHub, Facebook) via django-allauth
- Fully customizable serializers
Architecture
flowchart LR
Client[Client<br/>React / Vue / Mobile]
subgraph Django
subgraph dj-rest-auth
Auth[Login / Logout]
Reg[Registration]
PW[Password Reset]
end
DRF[Django REST Framework]
DJAuth[django.contrib.auth]
AA[django-allauth]
JWT[simplejwt]
end
Client <--> dj-rest-auth
Auth --> DRF
Auth --> DJAuth
Auth -.-> JWT
Reg -.-> AA
PW --> DJAuth
Quick Start
pip install dj-rest-auth
# settings.py
INSTALLED_APPS = [
...
'rest_framework',
'rest_framework.authtoken',
'dj_rest_auth',
]
# urls.py
urlpatterns = [
path('auth/', include('dj_rest_auth.urls')),
]
You now have: