Clients, CORS and client-secret lifecycle

This page covers the browser-facing and operational aspects of OAuth/OIDC clients: cross-origin (SPA) usage, and client-secret management (auto-generation, expiry, rotation).

Display name

Every client has a display_name used as the browser-tab <title> and the login-window heading on GET /oauth/authorize (and as the application name on the consent screen), so users see the application's name rather than an Ipseity/generic label. It defaults to the client_id when not set on create, and an update that omits it keeps the stored value. Existing clients without a stored name fall back to the client_id when rendering. The Clients page shows it as a column and exposes an editable "Client Display Name" field (the internal console client uses "Ipseity Console").

Managed console clients

Every realm automatically receives its own public console client. The main client retains ipseity-internal (or its configured ID); tenant IDs use a stable realm hash. Clients are labelled managed_console: true in their document and shown as Managed in the console. Managed IDs are reserved system-wide; creating, editing, deleting or rotating them through the REST API is forbidden. Their redirects, allowed origin, scopes and consent settings are reconciled by the server. See console.md for URLs and lifecycle details.

CORS for browser-based public clients

A SPA public client calls /oauth/token (and /oauth/introspect, /oauth/revoke) from a browser origin other than Ipseity's. To permit that:

  1. Set the client's allowed_origins to the exact browser origin(s), e.g. ["https://app.example.com"] (scheme + host + optional port, no path).
  2. Ipseity answers CORS preflight (OPTIONS) for these endpoints when the request Origin is any known allowed origin, and enforces the origin against the specific client on the actual POST — an Origin that is not in the client's allowed_origins is rejected with 403 and gets no CORS headers.

Origin matching is an exact (the literal wildcard * may be used to permit any origin). Backward compatibility: a client with no allowed_origins (or an empty list) is treated as having no origin restriction — requests with any Origin header are accepted but receive no CORS headers, which matches the pre-CORS behaviour for clients that predate the feature. Server-side (non-browser) usage always works because those requests carry no Origin header (browsers do send Origin even on same-origin POSTs, which is why the default console client carries its own origin).

Browser notes

  • Public clients authenticate the token request with PKCE (code_verifier), so no cookies/credentials are involved; the preflight response sets Access-Control-Allow-Credentials: true for symmetry.
  • The console UI sets allowed_origins on the Clients page (one origin per line).

Client-secret lifecycle

Private (non-public) clients authenticate with client_id + client_secret.

  • Auto-generation on create. Create a private client with an empty (or omitted) client_secret and Ipseity generates one and returns it in the create response exactly once (subsequent GET/list redact it).
  • Preserved on update. Updates that don't supply a new secret keep the stored one (and its expiry), so a partial update can't accidentally blank credentials.
  • Expiry. An optional client_secret_expires_at (unix seconds) makes the secret stop authenticating after that time (401 client secret has expired). Combined with rotation this gives a natural secret-aging policy: set a fixed expiry and rotate before it passes.
  • Rotation. POST /api/clients/<name>/rotate-secret (requires clients.write) generates a new secret, persists it, and returns it exactly once; the old secret immediately stops working. The internal UI client is managed by the server and cannot be rotated.

Example

# create a private client; the response contains the generated secret once
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"client_id":"svc","public_client":false,"redirect_uris":["https://cb.example/x"],"allowed_scopes":["openid"]}' \
  /api/clients

# rotate its secret (shown once in the response)
curl -X POST -H "Authorization: Bearer $TOKEN" /api/clients/svc/rotate-secret

Clients accept three additional optional fields used by the OIDC features covered in slo-consent-ratelimit.md:

  • require_consent (bool, default false) — when set, the authorization flow shows a user-facing consent screen listing the requested scopes before an authorization code is issued.
  • frontchannel_logout_uri (http(s)) — the page framed during OIDC front-channel single logout (receives iss and sid query parameters).
  • backchannel_logout_uri (http(s)) — the endpoint that receives a signed OIDC Back-Channel Logout token during single logout.

The Clients page exposes all three fields (Consent column, Logout URIs column, and editable form inputs).