Welcome to DRF Auth Kit documentation!
DRF AUTH KIT
Modern Django REST Framework authentication toolkit with JWT cookies, social login, and comprehensive user management.
Features
- 🔐 Multiple Authentication Types
JWT tokens with automatic refresh
DRF token authentication
Custom authentication support
- 🍪 Cookie-Based Security
Secure HTTP-only cookies
Automatic token management
CSRF protection
- 📧 Complete User Management
User registration with email verification
Password reset and change
Email verification workflows
- 🔧 Flexible Configuration
Multiple authentication backends
Customizable serializers and views
Django Allauth integration
- 🚀 Developer Experience
Full type hints support
Comprehensive test coverage
Auto-generated API documentation
Installation
pip install drf-auth-kit
Quick Start
Add to your Django settings:
INSTALLED_APPS = [
# ... your apps
'rest_framework',
'allauth',
'allauth.account',
'auth_kit',
]
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'auth_kit.authentication.AuthKitAuthentication',
],
}
AUTH_KIT = {
'AUTH_TYPE': 'jwt', # or 'token' or 'custom'
'USE_AUTH_COOKIE': True,
}
Include Auth Kit URLs:
from django.urls import path, include
urlpatterns = [
path('api/auth/', include('auth_kit.urls')),
# ... your other URLs
]
Run migrations:
python manage.py migrate
Authentication Types
- JWT Authentication (Recommended)
Access and refresh tokens
Automatic token refresh
Secure cookie storage
- DRF Token Authentication
Simple token-based auth
Compatible with DRF TokenAuthentication
Cookie support available
- Custom Authentication
Bring your own authentication backend
Full customization support
Integrate with third-party services
API Endpoints
The package provides these authentication endpoints:
POST /auth/login/- User authenticationPOST /auth/logout/- User logoutPOST /auth/registration/- User registrationPOST /auth/password/reset/- Password reset requestPOST /auth/password/reset/confirm/- Password reset confirmationPOST /auth/password/change/- Password changeGET/PUT/PATCH /auth/user/- User profile managementPOST /auth/registration/verify-email/- Email verificationPOST /auth/token/refresh/- JWT token refresh (JWT mode only)
Documentation
Please visit DRF Auth Kit docs for complete documentation, including:
Detailed configuration options
Custom serializer examples
Advanced usage patterns
Integration guides
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contents
User guide
Development