Register callbacks and map credentials
Add these blocks to your existingx-zenith configuration. Replace /auth/zenith/callback, the APP_* names, and the app service with your app’s values:
services list.
Declare one to eight unique callback paths starting with /. Zenith registers those paths on the deployment’s Zenith origin and verified custom-domain origin. Full URLs, wildcards, queries, and fragments are invalid.
Configure the OIDC client
Use your app’s OIDC library to configure the authorization flow:- Load discovery from the supplied issuer followed by
/.well-known/openid-configuration. - Request the
openidscope. Addemailandprofileif your app needs those claims. - Generate
state,nonce, and a PKCE verifier for the browser session. Send an S256 code challenge with the authorization request. - On the callback, verify
state. Exchange the code server-side with the same redirect URI and PKCE verifier. Authenticate withclient_secret_basicorclient_secret_post. - Validate the ID token’s signature, issuer, audience, expiry, and original nonce. Use the issuer’s JWKS to verify the signature.
- Identify the local account by the validated
subclaim. Create your app’s own session.
Link the owner’s initial account
If your app creates an administrator account before the first sign-in, set its local account ID to the owner’s OIDC subject. Addowner_id_env and its input alongside the credential aliases:
APP_ADMIN_ID with the variable your app uses to create the administrator account. The declaration must have input and cannot have generate, template, alias, or transform.
On a fresh deployment, Zenith pins this input to the owner’s immutable customer ID. Existing administrator identifiers remain unchanged. Your app must create and link the local account with that ID.
If your app handles account creation or linking through its OIDC client, omit owner_id_env.