
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Modern Django REST Framework authentication toolkit with JWT cookies, social login, and 2FA support
.. image:: https://img.shields.io/pypi/v/drf-auth-kit :target: https://pypi.org/project/drf-auth-kit/ :alt: PyPI
.. image:: https://codecov.io/github/forthecraft/drf-auth-kit/graph/badge.svg?token=lpj7sFpe3F :target: https://codecov.io/github/forthecraft/drf-auth-kit :alt: Code Coverage
.. image:: https://github.com/forthecraft/drf-auth-kit/actions/workflows/test.yml/badge.svg?branch=main :target: https://github.com/forthecraft/drf-auth-kit/actions/workflows/test.yml :alt: Test
.. image:: https://www.mypy-lang.org/static/mypy_badge.svg :target: https://mypy-lang.org/ :alt: Checked with mypy
.. image:: https://microsoft.github.io/pyright/img/pyright_badge.svg :target: https://microsoft.github.io/pyright/ :alt: Checked with pyright
.. image:: https://drf-auth-kit.readthedocs.io/en/latest/_static/interrogate_badge.svg :target: https://github.com/forthecraft/drf-auth-kit :alt: Docstring
Modern Django REST Framework authentication toolkit with JWT cookies, social login, MFA, and comprehensive user management.
Built as a next-generation alternative to existing DRF authentication packages, DRF Auth Kit provides a complete authentication solution with modern developer experience, inspired by dj-rest-auth but enhanced with full type safety, automatic OpenAPI schema generation, and comprehensive MFA support inspired by django-trench.
.. code-block:: bash
pip install drf-auth-kit
Optional Features:
.. code-block:: bash
# For MFA support
pip install drf-auth-kit[mfa]
# For social authentication
pip install drf-auth-kit[social]
# For both MFA and social
pip install drf-auth-kit[all]
Core Dependencies: Django 5.0+, DRF 3.0+, Django Allauth, DRF SimpleJWT
.. code-block:: python
INSTALLED_APPS = [
# ... your apps
'rest_framework',
'allauth', # Required for social auth
'allauth.account', # Required for social auth
# 'allauth.socialaccount', # For social login
# 'allauth.socialaccount.providers.google', # For Google login
'auth_kit',
# 'auth_kit.social', # For social authentication
# 'auth_kit.mfa', # For MFA support
]
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [
'auth_kit.authentication.JWTCookieAuthentication',
],
}
# Override only if needed:
# AUTH_KIT = {
# 'USE_MFA': True, # Enable MFA
# }
# Google OAuth2 settings (for social login)
# SOCIALACCOUNT_PROVIDERS = {
# 'google': {
# 'SCOPE': ['profile', 'email'],
# 'AUTH_PARAMS': {'access_type': 'online'},
# 'OAUTH_PKCE_ENABLED': True,
# 'APP': {
# 'client_id': 'your-google-client-id',
# 'secret': 'your-google-client-secret',
# }
# }
# }
2. Include Auth Kit URLs:
.. code-block:: python
from django.urls import path, include
urlpatterns = [
path('api/auth/', include('auth_kit.urls')),
# path('api/auth/social/', include('auth_kit.social.urls')), # For social auth
# ... your other URLs
]
3. Run migrations (only needed if using MFA):
.. code-block:: bash
python manage.py migrate
JWT Authentication (Recommended)
DRF Token Authentication
Custom Authentication
Please visit DRF Auth Kit docs <https://drf-auth-kit.readthedocs.io/>
_ for complete documentation, including:
Enhanced Multi-Factor Authentication
Passwordless Authentication
Advanced Security Features
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Modern Django REST Framework authentication toolkit with JWT cookies, social login, and 2FA support
We found that drf-auth-kit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.