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.4.tar.gz (38.8 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.4-py3-none-any.whl (49.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flask_headless_auth-0.1.4.tar.gz
  • Upload date:
  • Size: 38.8 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.4.tar.gz
Algorithm Hash digest
SHA256 e3a774d6e94a8763a1f9cf2a22643dab38876b8ccc0c213cdd07842a8e96d1a0
MD5 9ceb00f4eebf992ef10abb637783db0e
BLAKE2b-256 4606538f6f768036b50dcad875af1bc38cc1f95386f89ac08c95c93ef5d31b6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flask_headless_auth-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dea947e576abbc32f5777c7d8fcf0154624401faa0646534f6efa0b86300bec3
MD5 0aeb6f469a7c26e67ee3469a7190e83a
BLAKE2b-256 fe53a4b4f138b02afa9ac675af96858a7c9b198bd249a3f20b80d065b0413bc3

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