DRF Spectacular Auth Documentationο
π Simple Authentication UI for DRF Spectacular with AWS Cognito support
A Django package that adds a clean, simple authentication panel to your DRF Spectacular (Swagger UI) documentation, with built-in support for AWS Cognito and sessionStorage token management.
Featuresο
β¨ Key Features
π Simple & Secure: SessionStorage-based token management with CSRF protection
π¨ Clean UI: Modern authentication panel that integrates seamlessly with Swagger UI
π‘οΈ AWS Cognito Support: Built-in integration with AWS Cognito User Pools
π Smart Token Management: Client-side sessionStorage with manual token copy option
π― Auto Authorization: Automatically attempts to populate Swagger UI authorization headers
π¨ Customizable: Flexible theming and positioning options
π i18n Ready: Multi-language support (Korean, English, Japanese)
π§ Extensible: Plugin system for additional authentication providers
π¦ Easy Integration: Minimal setup with sensible defaults
β‘ Production Ready: Stable, maintainable codebase focused on reliability
Quick Startο
Installation:
pip install drf-spectacular-auth
Basic Setup:
# settings.py
INSTALLED_APPS = [
'drf_spectacular_auth', # Add before 'drf_spectacular'
'drf_spectacular',
# ... your other apps
]
DRF_SPECTACULAR_AUTH = {
'COGNITO_REGION': 'your-aws-region',
'COGNITO_CLIENT_ID': 'your-cognito-client-id',
'AUTO_AUTHORIZE': True,
}
# urls.py
from drf_spectacular_auth.views import SpectacularAuthSwaggerView
urlpatterns = [
path('api/auth/', include('drf_spectacular_auth.urls')),
path('api/docs/', SpectacularAuthSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
]
Thatβs it! π Your Swagger UI now has an authentication panel.
Table of Contentsο
User Guide
- Installation
- Quick Start Guide
- Configuration Reference
- Basic Configuration
- AWS Cognito Settings
- API Endpoint Configuration
- UI Configuration
- Theming Configuration
- Localization Settings
- Token Storage Configuration
- User Management Configuration
- Security Configuration
- Custom Template Configuration
- Extensibility Configuration
- Complete Example Configuration
- Environment Variables
- Next Steps
- Customization Guide