DRF Auth Kit - The modern auth toolkit for Django Rest Framework
Hi guys, I want to (re)introduce DRF Auth Kit after a long time without talking about it, so I think it's worth bringing it up again and sharing some updates since my last post.
So, first of all, why would you ever need another auth package when we already have django-allauth, dj-rest-auth, djoser,... Here is the list of reasons why I created drf-auth-kit, which is used in production by me and many people, and actively maintained:
- Full & strict type checking: mypy and pyright support (I plan to support ty after its beta) (something no other auth package has right now)
- Strictly follows the OpenAPI schema (with drf-spectacular support) (only django-allauth had this at the time I created the package)
- Dedicated to DRF, which means it's very easy to override any part: sign in, sign up (serializer, request, response)
- Easy to use, based on the well-known django-allauth for social account and email management. I reuse those parts to avoid reinventing the wheel, while the other parts like serializers, views, and URLs have been designed based on my experience working with dj-rest-auth, django-trench, and djoser, for the best experience on the API.
Those are the key things I felt were lacking when I used other auth libs. And here are the features + updates since my last post:
- Multiple authentication types: JWT (default), DRF token, or custom if you need (there's already an example)
- Cookie-based security: HTTP-only cookies
- Complete User Management: Registration, password reset, email verification, sign in.
- (new) Multi-Factor Authentication: Supports multiple MFA methods with backup codes, including passkeys and hardware security keys
- (new) Passwordless Authentication: Email magic links and passkey (WebAuthn) login
- Social Authentication: Django Allauth integration with 50+ providers, supporting both OAuth2 and OpenID Connect.
- Internationalization: Built-in support for 57 languages including English, Spanish, French, German, Chinese, Japanese, Korean, Vietnamese, and more
- Full Type Safety: Complete type hints with mypy and pyright
- OpenAPI Integration: Strictly best-practice auto-generated API documentation with DRF Spectacular
- Flexible Configuration: Customizable serializers, views, and authentication backends
- (Small extra): A UI (with the help of AI in this part) to easily try all the auth features quickly in dev/local environment
I have used it in production for a long time, and love it so much. I also actively maintain it and fix bugs raised by users. It's also listed in https://www.django-rest-framework.org/api-guide/authentication/#third-party-packages
Here is the info:
- Github: https://github.com/forthecraft/drf-auth-kit
- PyPI: https://pypi.org/project/drf-auth-kit/
Hope you guys love it as well. Feedback, feature requests, stars or improvements are welcome.