🐟AuthTuna
The Auth Framework For FastAPI
Why I made AuthTuna?
AuthTuna was built to address a challenge i have been working with from a long time (4+ years). I had been working with a auth system from 4+ years but its code got wayy to complex and unextendable. It was doing well but i just felt it was not enough as I was having trouble extending rbac implementing other complex flows with that. So i decided to rebuild it from scratch and thought why not just make it open source, simplify usage and take it up another level.
So then came about this library. I copied some part of my old codebase for rbac then enhanced the rbac system. Then when i put in mfa i was not happy opening my phone every time i login so i introduced the passkeys system so that i can just use my pc pin without opening the phone and use fingerprint phone.
Why should you use AuthTuna?
Imagine you are working on a API endpoint which is an authenticated endpoint and you want to quickly test it. With regular auth systems you may need to cook up a quick login page etc etc and some ui but if you use my library you can just login, create a master/secret (scoped) api key and use it in postman/curl or whatever so that you can quickly test your endpoint without any hassle.
This library simplifies integrating auth into any application. Previously you could have either used fastapi-users and spent time to extend its capabilities. But this library has enough features to have the highest security and the simplest usage.
Let us say you are prototyping something and want a simple login page within 2 lines of code and 2 env vars you can add basic login page and get_current_user dependency in no time.
Or you want to build a complex app with rbac, mfa, passkeys and social login you can do that too with minimal code.
Key Features
Multi-Factor Authentication (MFA)
Enhance security with built-in MFA support with TOTP.
Social Login
Integrate with popular social platforms (curr out of the box supports github and google, extendable).
Passkeys
Support for modern passwordless authentication using WebAuthn and passkeys for improved user experience and security.
Session Management
Robust session handling with customizable expiration, secure cookies, middleware and dependency injection for protecting routes.
Role-Based Access Control (RBAC)
Flexible permission system to manage user roles and access levels within your application.
FastAPI Integration
Designed specifically for FastAPI, leveraging its async capabilities and dependency injection system.