LibreChat SSO with Keycloak (OIDC)
Add Keycloak login to LibreChat and optionally require an explicit realm role.
Last updated
On this page (5)
LibreChat · Keycloak · OIDC
Before you start
- LibreChat environment configuration access.
- Keycloak realm administrator.
Configure sign-in
- Create a Keycloak OIDC client and register the public LibreChat URL ending in /oauth/openid/callback.
- Enable social login and configure OPENID_ISSUER, OPENID_CLIENT_ID, OPENID_CLIENT_SECRET, OPENID_SESSION_SECRET and OPENID_CALLBACK_URL, with openid profile email scopes.
- For role gating set OPENID_REQUIRED_ROLE, the correct token kind and the corresponding claim path (for realm roles, realm_access.roles).
Verify the result
- Test a user with the required role and a user without it.
- Check local login recovery before enforcing social-only access.
