OAuth surface
What Plat5 Auth exposes. It’s a native OAuth 2.0 issuer of signed JWT access tokens (ES256). /token returns an access token and a rotating refresh token, never an ID token, and there’s no userinfo endpoint and no OpenID Connect discovery document (/.well-known/openid-configuration is a 404). Relying parties validate tokens as JWT (JWKS + iss + aud + exp + sub).
Tokens carry no name. A relying party like Plat5 owns a person’s name.
Endpoints (local compose)
Section titled “Endpoints (local compose)”| Surface | URL |
|---|---|
| Public issuer / UI | http://localhost:5401 |
| JWKS | http://localhost:5401/.well-known/jwks.json |
| Authorization server metadata (RFC 8414) | http://localhost:5401/.well-known/oauth-authorization-server |
| Authorize | http://localhost:5401/authorize |
| Token | http://localhost:5401/token |
Listens on 5000; the dev compose publishes host port 5401 (the Plat5 local port block). Internal health (not published): INTERNAL_PORT default 5001.
Token identity
Section titled “Token identity”| Concern | Value |
|---|---|
| User id type | ULID string |
| JWT subject claim | Standard sub ("<ulid>"), plus top-level email when AUTH_TOKEN_EMAIL=true (env.md). Never a name |
| Signing | ES256 JWKS (kid in header); keys stored in Postgres users.signing_keys |
iss |
PUBLIC_ISSUER_URL when set, else the incoming request origin |
Relying parties use the standard sub claim (Plat5’s default AUTH_SUBJECT_CLAIM=sub) and email (operator’s default AUTH_OPERATOR_EMAIL_CLAIM=email).
Clients and redirects
Section titled “Clients and redirects”| Env | Purpose |
|---|---|
AUTH_CLIENTS_FILE |
Multi-client JSON file with per-client id, redirect_uris, and optional audiences (mutually exclusive with flat client env vars) |
AUTH_ALLOWED_CLIENTS |
Single OAuth client ID (default plat5; at most 1 client — use AUTH_CLIENTS_FILE for multiple clients) |
AUTH_ALLOWED_REDIRECT_URIS |
Redirect URI allowlist for the single flat client (unset defaults to empty → deny-all; validated as http:///https:// without #fragment) |
AUTH_ALLOWED_AUDIENCES |
Optional audience allowlist for the single flat client (empty = omitted or client_id only) |
AUTH_ALLOWED_ORIGINS |
Browser CORS origins (bare http:///https:// origins) |
Per-client redirect_uris and audiences are enforced on /authorize, /token (both authorization_code and refresh_token), and /dev/token. Operators set client IDs to match whatever audience / client their API gateway expects (e.g. Plat5 often uses audience plat5).
Auth flows
Section titled “Auth flows”- Password codes via email when
SMTP_*is set (BYO SMTP); codes are logged only whenAUTH_DEV_MODE=true - OAuth 2.0 authorization code + mandatory PKCE (
code_challenge+code_challenge_method=S256, RFC 7636) and rotating refresh tokens with family reuse detection. Requests to/authorizewithout a valid 43-character base64urlS256code_challengeare rejected with400 invalid_request;/tokenrequires a matching RFC 7636code_verifier. Anyscopequery parameter on/authorizeis ignored and never emitted in tokens. - Default first UI after
/authorizeis password login (/login). Addprompt=createto land on register (/register) instead (e.g. a “Create account” button). Allow-check and the authorization session cookie are unchanged. Onlycreateis honored; otherpromptvalues are ignored.none/login/consentare not implemented. Do not send users to/registerdirectly — that requires an active authorization session from/authorize.
Dev-only token mint
Section titled “Dev-only token mint”When AUTH_DEV_MODE=true (exact string), the issuer exposes:
POST /dev/tokenContent-Type: application/json
{ "email": "[email protected]", "client_id": "plat5" }| Field | Required | Notes |
|---|---|---|
email |
yes | Lowercased; getOrCreateUser(password, email) → stable ULID |
client_id |
no | Defaults to the first configured client; must be a configured client |
audience |
no | Defaults to client_id. When that client’s audiences is empty, must match client_id; when non-empty, must be in that client’s audiences |
Other fields, name among them, are ignored.
Response 200:
{ "access_token": "<jwt>", "token_type": "Bearer", "expires_in": 3600, "user_id": "<ulid>"}JWT shape matches normal access tokens (sub = user ULID, plus top-level email when AUTH_TOKEN_EMAIL=true, aud = audience/client_id, signed with the same JWKS keys). No name.
Off by default. Unless AUTH_DEV_MODE is exactly true, the route is not registered (returns 404). The same flag also makes the issuer log login codes when SMTP is incomplete (env.md). The dev compose file sets AUTH_DEV_MODE: "true"; prod compose does not. When it is on, the issuer logs a warning at boot. It mints a valid token for any email, so never enable it on a reachable deployment.
Intended for local e2e / smoke tests so operators do not walk the browser + email-code flow.
Database
Section titled “Database”Own Postgres. Default local DB name: auth. Schema users (relational tables for users, password credentials, signing keys, auth sessions/codes, refresh tokens, verification codes, and invites). Not shared with other products.
Network boundary
Section titled “Network boundary”Own Docker network (auth). Do not join other products’ networks. Publish its port 5000; consumers reach JWKS over host or public URL.