dj-rest-auth
Authentication and Registration in Django Rest Framework
What it is and what it does
dj-rest-auth is a Django REST Framework library that exposes standard authentication workflows as HTTP endpoints, eliminating the need to build login, logout, registration, and password reset flows from scratch. It integrates with Django's built-in authentication system and provides endpoints like /auth/login/, /auth/logout/, /auth/password/reset/, and user detail endpoints that return JSON responses suitable for single-page applications and mobile clients.
The package supports multiple authentication strategies: token-based auth, JWT with HTTP-only cookies, and optional social authentication via django-allauth. It also includes an opt-in MFA sub-package with TOTP and recovery codes. Because it depends on both Django and djangorestframework, it is intended for projects already using Django REST Framework; it is not a standalone authentication service.
Use it for:
- Build a REST API for a React or Vue SPA that needs login, logout, and user profile endpoints without writing custom auth views
- Add user registration with email verification to a Django REST API without implementing the workflow manually
- Implement JWT-based authentication with secure HTTP-only cookies in a mobile app backend
- Add multi-factor authentication (TOTP) to an existing Django REST API with minimal configuration
- Enable social login (Google, GitHub, Facebook) in a REST API using django-allauth integration
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides drop-in REST API endpoints for user authentication, registration, password management, and multi-factor authentication in Django REST Framework applications.
Yes, if you are building a Django REST Framework API and need standard authentication endpoints. The package is actively maintained, has no known vulnerabilities, and eliminates significant boilerplate. High install friction is offset by the time saved on auth implementation. Not suitable if you are not already using Django and djangorestframework.
Install
dj-rest-auth on PyPI
pip
pip install dj-rest-authuv
uv add dj-rest-authpoetry
poetry add dj-rest-authInstalling dj-rest-auth
Before you install
High install friction due to two required runtime dependencies (Django and djangorestframework). Package is actively maintained with recent commits and no known vulnerabilities, but setup requires integrating into an existing Django project and configuring multiple settings.
License in practice
MIT license is permissive and imposes no restrictions on use, modification, or distribution in commercial or private projects.
Quickstart
pip install dj-rest-auth djangorestframework
# settings.py
INSTALLED_APPS = [
'rest_framework',
'rest_framework.authtoken',
'dj_rest_auth',
]
# urls.py
from django.urls import path, include
urlpatterns = [
path('auth/', include('dj_rest_auth.urls')),
]
# Now POST to /auth/login/ with {"username": "...", "password": "..."}
Requires an existing Django project with djangorestframework installed and configured; Django database migrations must be run after adding dj_rest_auth to INSTALLED_APPS.
Verify before relying
- Whether social authentication (Google, GitHub, Facebook) requires additional setup beyond the 'with-social' extra
- Performance characteristics under high concurrent authentication load
- Compatibility with specific versions of Django and djangorestframework beyond the minimum Python 3.10 requirement
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | high — source build required |
| Runtime dependencies | 2 — Django, djangorestframework |
| Maintenance | actively maintained — 152 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 815,464/month — #4,990 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: dj_rest_auth-7.2.0.tar.gz
Keywords: django, rest, auth, registration, rest-framework, django-registration, api
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
django-maintenance-modeActivates a 503 maintenance page in Django…
permissive · top 15,000 on PyPI
django-rest-passwordresetProvides REST API endpoints for Django…
permissive · top 15,000 on PyPI
djoserProvides Django REST Framework views for user…
permissive · top 15,000 on PyPI
django-allauth-2faAdds two-factor authentication to…
permissive · top 15,000 on PyPI
django-rest-knoxProvides token-based authentication for Django…
permissive · top 5,000 on PyPI
django-registration-reduxProvides user registration and signup…
permissive · top 15,000 on PyPI
drf-jwtAdds JSON Web Token (JWT) authentication to…
permissive · top 15,000 on PyPI
djangorestframework-jwtAdds JSON Web Token (JWT) authentication…
permissive · top 15,000 on PyPI
django-allauthProvides integrated local and social…
permissive · top 5,000 on PyPI
django-ninja-jwtProvides JWT authentication for Django-Ninja…
permissive · top 15,000 on PyPI