Keycloak setup
Holotable derives all authorization from the groups claim of the session
token. Keycloak does not include group memberships in tokens by default —
you must add a group-membership mapper.
1. Realm, client, groups
Section titled “1. Realm, client, groups”-
Create (or reuse) a realm, e.g.
holotable. -
Create an OpenID Connect client:
- Client ID:
holotable - Client authentication: On (confidential) → copy the client secret.
- Valid redirect URIs:
http://localhost:3000/api/auth/callback(add your production origin too). - Standard flow: enabled.
- Client ID:
-
Create the groups that encode roles. Group paths must match exactly:
/workspaces/{workspaceId}/viewer/workspaces/{workspaceId}/editor/workspaces/{workspaceId}/source-admin/platform-adminsFor a workspace
acme: create a top-level groupworkspaces, a childacme, and childrenviewer/editor/source-admin. Create a separate top-level groupplatform-adminsfor global admins, then assign users.
2. Add the group-membership mapper
Section titled “2. Add the group-membership mapper”The mapper puts full group paths into a groups claim.
- Client → Client scopes →
holotable-dedicated→ Add mapper → By configuration → Group Membership. - Configure:
- Name:
groups - Token Claim Name:
groups - Full group path: On — produces
/workspaces/acme/editor, which is what Holotable parses. - Add to ID token: On
- Add to access token: On
- Add to userinfo: On
- Name:
- Save.
3. Point Holotable at the realm
Section titled “3. Point Holotable at the realm”Set these in .env (see .env.example):
OIDC_ISSUER=http://localhost:8080/realms/holotableOIDC_CLIENT_ID=holotableOIDC_CLIENT_SECRET=<client secret>OIDC_JWKS_URL=http://localhost:8080/realms/holotable/protocol/openid-connect/certsOIDC_GROUPS_CLAIM=groupsOIDC_SCOPE=openid profile email groupsOIDC_JWKS_URLenables RS256 verification of Keycloak-issued tokens.- The
profileandemailscopes putnameandemailin the id_token. The account menu and Settings → Account display them; they are never used for authorization, and a token without them still signs in. OIDC_ACCOUNT_URL(optional) is linked from Settings → Account so people can manage what Keycloak owns. For Keycloak it is the issuer followed by/account, e.g.http://localhost:8080/realms/holotable/account.- The login flow lives at
/api/auth/login→ Keycloak →/api/auth/callback, which verifies the token and mints a first-party session cookie.
4. Verify the claim
Section titled “4. Verify the claim”Decode an issued token and confirm it contains:
{ "sub": "…", "groups": ["/workspaces/acme/editor", "/platform-admins"]}If groups is missing or contains bare names rather than paths, revisit step 2.
How those paths become roles is described in
Authorization model.