Modern, headless authentication for Flask APIs. JWT + OAuth + RBAC in one line.
Project description
Flask-Headless-Auth
Modern, headless authentication for Flask APIs.
A production-ready Flask authentication service package with JWT support, OAuth integration, and flexible token delivery modes. Perfect for SPAs, mobile apps, and API-first applications.
✨ Features
- ✅ Headless Architecture - API-first design for modern SPAs and mobile apps
- ✅ JWT Authentication - Secure access + refresh token pattern
- ✅ OAuth Support - Google, Microsoft SSO integration
- ✅ Configurable Token Delivery - Cookies, headers, or both
- ✅ Role-Based Access Control - RBAC support built-in
- ✅ Multi-Factor Authentication - MFA support out of the box
- ✅ Email Verification - Email confirmation workflows
- ✅ Password Reset - Secure password reset flows
- ✅ Production Security - httpOnly cookies, CSRF protection, rate limiting
- ✅ Caching & Performance - Redis/SimpleCache integration
- ✅ Framework Agnostic Frontend - Works with React, Vue, Angular, Next.js, etc.
🚀 Quick Start
Installation
pip install flask-headless-auth
Basic Setup (5 minutes)
from flask import Flask
from flask_headless_auth import AuthSvc
app = Flask(__name__)
# Minimal configuration
app.config['SECRET_KEY'] = 'your-secret-key'
app.config['JWT_SECRET_KEY'] = 'your-jwt-secret-key'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.db'
# Initialize - that's it!
auth = AuthSvc(app)
if __name__ == '__main__':
app.run()
Your API now has authentication endpoints ready at /api/auth/* 🎉
📚 Documentation
- Full Documentation - Complete guide with examples
- Configuration Examples - Detailed config options
- Migration Guide - Upgrade from older versions
🎯 Why Headless?
Flask-Headless-Auth is designed for modern, decoupled architectures:
- API-First: Pure REST API with no server-side rendering
- Frontend Agnostic: Works with any frontend framework
- Mobile-Ready: Perfect for React Native, Flutter, native mobile apps
- Microservices: Ideal for distributed systems and microservices
🔒 Security First
Built with industry-standard security practices:
- HttpOnly cookies for XSS protection
- CSRF protection with SameSite cookies
- Rate limiting to prevent brute force attacks
- Secure password hashing with bcrypt
- Token blacklisting for logout
- Configurable token expiration
🛠️ Technology Stack
- Flask - Web framework
- Flask-JWT-Extended - JWT token management
- Flask-SQLAlchemy - Database ORM
- Authlib - OAuth integration
- Flask-Limiter - Rate limiting
- Flask-Caching - Performance optimization
📦 What's Included
Authentication Endpoints
- User registration and login
- Token refresh and logout
- Email verification
- Password reset
- OAuth (Google, Microsoft)
User Management
- Profile management
- Role-based permissions
- Multi-factor authentication
- Activity logging
Developer Experience
- Drop-in solution (5-minute setup)
- Sensible defaults
- Extensive configuration options
- Clear error messages
- Type hints included
🤝 Contributing
Contributions welcome! Please see our Contributing Guidelines.
📄 License
MIT License - See LICENSE file for details.
🙏 Credits
Developed with ❤️ by Dhruv Agnihotri
Built with Flask, Flask-JWT-Extended, Flask-SQLAlchemy, and Authlib.
Made with security in mind. Deploy with confidence. 🔒
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask_headless_auth-0.1.0.tar.gz.
File metadata
- Download URL: flask_headless_auth-0.1.0.tar.gz
- Upload date:
- Size: 35.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8247074a105968405561c8ec007b347326e4f128d5d4fdefa441e113b68f2268
|
|
| MD5 |
0c7d4ced8447c4a24754c15d8e5bdbf5
|
|
| BLAKE2b-256 |
53e5384597b0cfff6bb8b86f52c152438bceb96d00a24d7c99b8003fffcba71e
|
File details
Details for the file flask_headless_auth-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flask_headless_auth-0.1.0-py3-none-any.whl
- Upload date:
- Size: 46.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
861edbf039babd94ed06dd6859eab382e069125fb1cd3c37511f16ed9d9a7475
|
|
| MD5 |
78b74b2db9f63f4a0e8725c3f110c93b
|
|
| BLAKE2b-256 |
5431b632e0f7917b30de6eb13da68a7a65376ad500292a378ff8debb8d667780
|