Skip to content

Prism OAuth

Lumen authenticates users via Prism. The session lives in a httpOnly cookie backed by a KV entry; the Prism access token is refreshed automatically when it nears expiry, provided the user granted offline_access.

Required scopes

Lumen requests these OAuth scopes when redirecting to Prism:

ScopePurpose
openidOpenID Connect identity
profileDisplay name, avatar
emailAccount email
teams:readUsed for team-restricted access (allowed_team_id)
offline_accessRefresh tokens — required for long sessions

Creating the OAuth application in Prism

  1. Open Prism → Connected AppsCreate app.
  2. Set the Redirect URI to https://<your-host>/callback.
  3. Enable PKCE. Lumen defaults to PKCE; you can disable it and use a client secret instead by toggling Use PKCE in the InitPage and supplying a secret.
  4. Copy the Client ID (and Client secret if not using PKCE).

Filling in the InitPage

FieldNotes
Prism Base URLe.g. https://prism.siiway.org
Client IDFrom Prism
Use PKCERecommended
Client secretRequired when PKCE is disabled
Redirect URIDefaults to https://<host>/callback
Allowed team IDComma-separated team IDs to restrict who can sign in

Settings are stored in KV under the key config:app and can be edited later from the Worker. Set ALLOWED_TEAM_ID as an environment variable in wrangler.jsonc if you want to lock it from being overridden in the UI.

Re-running the init flow

The init flow is gated by init:configured in KV. To re-run it, delete that key:

sh
bunx wrangler kv key delete --binding=KV init:configured

If you only want to change config (not the schema) you can keep init:configured = true and edit values via PUT /api/init/config (only team owners can do this when allowed_team_id is non-empty).