django-rest-auth
raw JSON → 0.9.5 verified Mon Apr 27 auth: no python maintenance
Django-rest-auth provides a set of REST API endpoints for authentication and registration in Django projects using Django REST Framework. Version 0.9.5 is the latest release, but the library is in maintenance mode with no active development; it is superseded by dj-rest-auth.
pip install django-rest-auth==0.9.5 Common errors
error ImportError: No module named 'rest_auth' ↓
cause Package not installed or installed under different name.
fix
pip install django-rest-auth
error django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: rest_auth ↓
cause Old version installed side-by-side with dj-rest-auth or duplicate app config.
fix
Uninstall django-rest-auth and use only dj-rest-auth: pip uninstall django-rest-auth; pip install dj-rest-auth
error AttributeError: 'LoginView' object has no attribute 'authentication_classes' ↓
cause Misconfigured serializer or custom view inheritance.
fix
Ensure you are using correct view class and serializer; check documentation for custom LoginView.
error TypeError: __init__() got an unexpected keyword argument 'request' ↓
cause Serializer called incorrectly or outdated version.
fix
Update to latest version (0.9.5) and check serializer instantiation patterns.
Warnings
gotcha This library is no longer actively maintained; consider using dj-rest-auth instead. ↓
fix Replace django-rest-auth with dj-rest-auth and update import paths (from rest_auth to dj_rest_auth).
breaking In Django 3.0+, the on_delete argument is required for ForeignKey fields; django-rest-auth's internal models may cause migration issues. ↓
fix Add on_delete=models.CASCADE to any custom models or use dj-rest-auth which has updated support.
gotcha Social authentication requires additional endpoints and configuration with django-allauth; default URLs do not include social login. ↓
fix Use rest_auth.urls or include rest_auth.social_urls and set up social apps in Django admin.
deprecated The old JWT support via django-rest-framework-jwt is deprecated and incompatible with newer Django REST Framework versions. ↓
fix Use dj-rest-auth with djangorestframework-simplejwt instead.
Imports
- rest_auth.views wrong
from rest_auth.views import Logincorrectfrom rest_auth.views import LoginView - rest_auth.serializers
from rest_auth.serializers import LoginSerializer
Quickstart
# settings.py
INSTALLED_APPS = [
'django.contrib.sites',
'allauth',
'allauth.account',
'rest_auth',
'rest_framework',
]
SITE_ID = 1
# urls.py
from django.urls import path, include
urlpatterns = [
path('rest-auth/', include('rest_auth.urls')),
]
# Then run python manage.py migrate