Skip to main content

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.

PyPI version Python 3.8+ License: MIT

✨ 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

🎯 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_headless_auth-0.1.1.tar.gz (36.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_headless_auth-0.1.1-py3-none-any.whl (46.6 kB view details)

Uploaded Python 3

File details

Details for the file flask_headless_auth-0.1.1.tar.gz.

File metadata

  • Download URL: flask_headless_auth-0.1.1.tar.gz
  • Upload date:
  • Size: 36.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for flask_headless_auth-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7f645a97516a238a5ed8a42c3082d51fbd9ed4510c768563d1b13fad32613496
MD5 2bb326e86a23b3e32b1b00617d1530d8
BLAKE2b-256 00d0d26a2ea11b6cd44560f3586a3ce51f241d84b82429765cc9315cd186c67c

See more details on using hashes here.

File details

Details for the file flask_headless_auth-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_headless_auth-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 392f75404d053e3a7c34f772632aad90ada9f1f6ad80130d398117f44c0d1fcd
MD5 588b4df6cd3fed2ab08d944d84dc06e3
BLAKE2b-256 6c2457bb8cfe0b6f39a882e26add50568660d5a8c68a3238e4667822f9574d2d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page