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.2.tar.gz (37.5 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.2-py3-none-any.whl (48.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flask_headless_auth-0.1.2.tar.gz
  • Upload date:
  • Size: 37.5 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.2.tar.gz
Algorithm Hash digest
SHA256 7ab1c5457d240a251d50043d87b69a00d5187ac5042c6034b396c6bbb40c6458
MD5 31d7f7abe8fd949391917596a45e624a
BLAKE2b-256 deef6ba9d20d761e5fd09f64326e4391d5b09f6f48af1c5a9117500e7f2ab055

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flask_headless_auth-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 31601126e4a0f2f9ed2c02c964d06ef70ecd61f7afa0e19b72e0085da5b8384b
MD5 9f379d62fc3a12bb088fdf30929cfb03
BLAKE2b-256 61429bb14dd51b5255d5667be78e1425a2a394ba916bafa80099ad61d3b88908

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