Flask Guide

Flask Authentication

Add user authentication to Flask applications using the GitHat REST API. JWT tokens, session management, and multi-org support for Python backends.

GitHat API for Flask

Flask applications can integrate GitHat auth via the REST API. Register users, issue tokens, and validate sessions by calling api.githat.io from your Flask routes.

Token Validation

Protect Flask routes by checking the Authorization header. Forward the Bearer token to GitHat's /auth/me endpoint to verify the user's identity and get their org context.

Multi-Org Support

Build SaaS applications with Flask and GitHat. Each user can belong to multiple organizations with different roles (owner, admin, member). The API handles role-based access control.

Install

pip install requests

Example

# app.py
import requests
from flask import Flask, request, jsonify

app = Flask(__name__)
GITHAT_API = 'https://api.githat.io'

@app.route('/api/login', methods=['POST'])
def login():
    data = request.json
    resp = requests.post(f'{GITHAT_API}/auth/login', json={
        'email': data['email'],
        'password': data['password']
    })
    return jsonify(resp.json()), resp.status_code
Try GitHat free

Ship authenticated apps in minutes, not weeks.