Authdog

Python

Last updated Sep 17, 2026
View as Markdown

Authdog’s Python bindings are one package, five frameworks. Each framework has its own guide and five-minute path. Pick the one you run:

Framework Guide Quickstart Extra
FastAPI Guide Quickstart [fastapi]
Django Guide Quickstart [django]
Flask Guide Quickstart [flask]
Starlette Guide Quickstart [starlette]
aiohttp Guide Quickstart [aiohttp]

All five share the same cookie / bearer token and OIDC userinfo flow. The public key (pk_...) selects the environment.

Install

These session bindings are not the PyPI package authdog. pip install authdog installs the management API client (AuthdogClient, 0.1.1). It does not provide authdog.fastapi or the other framework modules.

The bindings are unreleased on PyPI. Do not pip install authdog-fastapi in production. Source lives in `packages/python` (Python 3.10+, httpx 0.27+). Clone or pin a commit, then install the extra for your framework:

python -m pip install "./packages/python[fastapi]"

Minimum extras: FastAPI 0.110, Django 4.2, Flask 3.0, Starlette 0.37, aiohttp 3.9. Published compatibility is not yet guaranteed.

Shared contract

Every binding resolves the same AuthdogContext (token, user, is_authenticated, user_info). The resolver prefers authdog-session, then Authorization: Bearer <token>. Missing or failed userinfo yields anonymous context. Only meta.code == 200 with a user sets is_authenticated.

session / middleware is informational. require_auth is the 401 boundary. fetch_user=False leaves user as None and is_authenticated false, so the built-in gate rejects.

Django and Flask drive userinfo with asyncio.run on their sync view paths. Starlette and aiohttp are async.

Next