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.3.tar.gz (38.2 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.3-py3-none-any.whl (48.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flask_headless_auth-0.1.3.tar.gz
  • Upload date:
  • Size: 38.2 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.3.tar.gz
Algorithm Hash digest
SHA256 7ac1d21610f253de6eda94514e4eb1430b1d539dbae4052636e953c34dbbaf4a
MD5 d472239ed37621e8ff8da91a42ea5651
BLAKE2b-256 6558820751932bbb7f16bf75a8949f06e9ad288304c712f4d47863427c692e3f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flask_headless_auth-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c340b5fbf2bd9d3cfd88350ef11335cb3e26664fd7019b3e342d5071ae4a7fed
MD5 64853769a666b01d790cc996b2a805c8
BLAKE2b-256 1defd198db80ccea91e1e86a04ddd9bae1c5442c56da9b029ab07d5bfdb66ec9

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