au1h

Examples

Four tiny backends, one per language, all authenticating against one au1h.

The repository ships four minimal backends in examples/. Each serves a demo page and a protected GET /api/me that verifies the au1h JWT and returns the signed-in user.

LanguageFolderStackPortSlug
Gogo/net/http + the Go SDK8081example-go
Rustrust/axum + jsonwebtoken8082example-rust
Pythonpython/FastAPI + the Python SDK8083example-python
TypeScripttypescript/Bun + Hono + @au1h/server8084example-typescript

The demo

Sign in with the same email in all four apps. Each app shows a different user id and application id, because au1h scopes identity per application. Copy one app's token to another app's backend and it is rejected: the token's aud is the wrong slug.

Run

  1. Register the four applications in the admin portal with the slugs above and allowed origin http://localhost:<port>.
  2. Start each backend in its own terminal:
cd examples/go         && go run .
cd examples/rust       && cargo run
cd examples/python     && uv run main.py
cd examples/typescript && bun run dev
  1. Open http://localhost:8081 … 8084 and sign up.

Each backend reads PORT, AU1H_URL and AU1H_APP_SLUG from the environment; the defaults match the table. examples/README.md has the full walkthrough and the things to expect when all four run on one machine.

On this page