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

  1. Create a Keycloak OIDC client and register the public LibreChat URL ending in /oauth/openid/callback.
  2. 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.
  3. 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.

Official documentation

Have Pilae connect your identity provider

Pilae can deploy LibreChat with your identity provider already connected. We agree the edition, account mapping and access tests with your team before rollout.