Rocket.Chat and Keycloak SSO integration

A team that runs Keycloak for workforce sign-in can point Rocket.Chat at it over SAML or OpenID Connect. This page covers the method choice, prerequisites, setup order, attribute and group mapping, and the features that need a paid plan.

On this page

How Rocket.Chat and Keycloak SSO integration works

The integration uses either SAML 2.0 or OpenID Connect, configured on both sides, with Keycloak acting as the identity provider and Rocket.Chat as the service provider or relying party. Keycloak supports OpenID Connect, OAuth 2.0 and SAML 2.0, and provides single sign-on and identity brokering, so one Keycloak realm can serve Rocket.Chat alongside your other applications. On the Keycloak side you create a client for Rocket.Chat that matches the protocol you choose. On the Rocket.Chat side, the matching SSO provider is configured in the workspace administration settings, where you enter the endpoints, identifiers and certificates that Keycloak issues.

Both sides have to agree on the same identifiers, redirect or callback URLs and signing material before a single login succeeds. Expect to exchange certificates or client secrets, confirm the exact URLs Rocket.Chat expects for your public domain, and decide which Keycloak attributes map to the Rocket.Chat username and email fields. Because the Rocket.Chat setting names and screens change between versions, confirm every field name in the Rocket.Chat SSO documentation for the exact version you run before you copy values across. No Rocket.Chat SSO guide was supplied for this page, so treat any setting name you see here as something to verify.

Plan the protocol choice early. SAML and OpenID Connect differ in how attributes and signing keys are passed, how logout is handled and how the client is registered in Keycloak, and the choice affects the attribute mappers, email requirements and group handling covered in the later sections. Record which realm, client and token settings you chose, along with the certificate or secret owner and its rotation date, so the integration can be tested and renewed without guesswork.

What you need before starting the Keycloak connection

Most SSO delays come from missing prerequisites rather than from the connection itself. Confirm these six items on both systems before anyone creates a client or uploads a certificate, because each one changes what the integration step looks like.

Keycloak on a supported release

Run a release that the Keycloak project still maintains. The current release is 26.8.1, published October 13, 2026, and the project ships four minor releases a year. Record the exact version you run, because client settings and admin console labels shift between releases. Confirm with your own team whether you run the community build, the Keycloak Operator, or Red Hat build of Keycloak, since the support path differs for each.

Keycloak docs

Production database, not the dev-file store

Keycloak supports production databases including PostgreSQL 14 to 18. The default dev-file database is for development only, so a Keycloak instance serving Rocket.Chat logins must use a supported production database from day one. Ask the team that owns the database who will back it up and who approves schema changes during upgrades.

Database guide

Rocket.Chat 8.x on MongoDB replica set

Rocket.Chat 8.x requires MongoDB 8.0 or later running as a replica set. A three-member replica set is strongly recommended for high availability. Check the Rocket.Chat version against its vendor support window before starting, because an unsupported version can lose connectivity to the official mobile and desktop clients. Plan the upgrade first if you are still on an older line.

System requirements

A Rocket.Chat plan that includes SSO

SSO is not available on every tier. The free Starter plan includes single sign-on, but confirm the plan that covers your user count and the group or role mapping features you need. Group mapping for SAML and LDAP sits in the paid plans. Ask Rocket.Chat or your account contact to confirm in writing which plan covers each feature before you commit to a design.

Plans overview

Public HTTPS hostnames and valid TLS

Give Keycloak and Rocket.Chat stable public HTTPS hostnames with certificates that browsers trust. The redirect URIs, issuer URLs, and SAML audience values all depend on these hostnames, so a change later means reconfiguring both systems. Confirm that the certificate chain is complete and that internal clients can resolve both names.

Named Keycloak administrator and hostname agreement

Name one Keycloak administrator who owns the realm, the client definitions, and the signing certificate. Keycloak certificates and Rocket.Chat endpoints must agree on hostnames, so the same names must appear in both configurations. Agree on the hostname list with the Rocket.Chat owner before either side is changed, and write down who approves a certificate rotation.

SAML or OpenID Connect: which protocol to choose

SAML 2.0 is an XML-based federation protocol. In a Keycloak setup, Keycloak acts as the SAML identity provider and Rocket.Chat acts as the service provider. The two sides trust each other through certificates and metadata rather than a shared secret, so the certificate exchange is the core of the work. You download the realm's SAML metadata or signing certificate from Keycloak, then configure Rocket.Chat's SAML settings with the identity provider's entity ID, single sign-on URL and signing certificate. Confirm which fields your Rocket.Chat version exposes in the administration panel before you plan the exchange.

  • Signing certificate ownership: Decide who issues, stores and rotates the Keycloak signing key, and record the expiry date so a rotation does not lock users out.
  • Metadata handling: Decide whether metadata is imported as a file or entered by hand. Manual entry is more error prone when certificates change.
  • Entity ID and callback values: Entity IDs and assertion consumer URLs must match exactly on both sides, including scheme and trailing path.
  • Assertion attributes: Map the user name, email and any group attributes into the SAML assertion, which is where attribute mappers in Keycloak are configured.
  • Clock and time sync: Assertions carry validity windows, so clock drift between servers causes intermittent sign-in failures.

Before choosing SAML, confirm with your security team that they already manage SAML signing certificates and have a rotation procedure for them.

How a Rocket.Chat login flows through Keycloak

The sign-in starts in the browser, where the user opens Rocket.Chat and is redirected to Keycloak. Keycloak authenticates the user, including any MFA configured in the realm, then returns a SAML assertion or OIDC token through the browser. Rocket.Chat validates that response against the certificate or client secret it was configured with, maps the attributes it receives, and creates or updates the local account. Check the redirect URIs, the signing certificate and the mapped email attribute at each hand-off, since most failed logins fail at one of them.

Sign-in path between the browser, Rocket.Chat and Keycloak, with the validation step.

Configuring Keycloak and Rocket.Chat in sequence

This sequence sets up Keycloak as the identity provider for Rocket.Chat, passes the matching endpoints and certificates across, and confirms that sign-in, attribute mapping and sign-out behave correctly before users depend on it.

  1. Create or select the Keycloak realm

    The Keycloak administrator creates a dedicated realm for workforce sign-in, or selects an existing one that already holds the users who need Rocket.Chat access. Keep test users in a separate realm or group if your production realm holds real staff records. Confirm the realm's login page loads at your Keycloak hostname over TLS and that a test user can sign in to the account console. Record the realm name, because every endpoint in the Rocket.Chat settings includes it.

  2. Create the Rocket.Chat client in Keycloak

    Create a client for Rocket.Chat using OpenID Connect or SAML, depending on the protocol your team has chosen. For OpenID Connect, set the client authentication and the redirect URI to the callback path shown in the Rocket.Chat SSO settings for your Keycloak service. For SAML, set the entity ID and assertion consumer URL from Rocket.Chat's service provider details. If you manage Keycloak with the Operator, define the client as a KeycloakOIDCClient or KeycloakSAMLClient resource instead of creating it in the console, and keep the definition in version control. Confirm that the client appears in the realm with the expected protocol and redirect URI.

  3. Set certificate or secret handling

    For OpenID Connect, generate the client secret and store it in your secrets manager rather than in a shared document, then rotate it on a schedule your security team sets. For SAML, export the realm's signing certificate, or upload the Rocket.Chat service provider certificate if you sign requests, and record which certificate is active so a rotation does not break sign-in. Restrict who can view or regenerate the secret. Check that the certificate fingerprint or secret reference in your records matches what Keycloak shows in the client settings.

  4. Configure attribute mappers for email, username and name

    Add mappers to the client so Keycloak sends the email address, username and display name in the token or SAML assertion. Keep the claim names exactly as Rocket.Chat expects them in its SSO attribute settings, because a mismatch is the most common cause of accounts being created with blank or duplicate fields. Make sure the email mapper uses the verified email attribute and that users in the test group have a verified address. Check the result by decoding a test token or reviewing the SAML response, and confirm the three values match the user's Keycloak profile.

  5. Enter endpoints and certificates in Rocket.Chat

    A Rocket.Chat workspace administrator opens the SSO settings and enters the endpoints, client identifier, secret or certificate from the previous steps, and the attribute names that match the mappers. Save the configuration and keep the existing admin password login available until the test in the next step passes, so a misconfiguration cannot lock out every administrator. Confirm that the login page now shows the Keycloak button and that the settings save without validation errors. Record the configuration change in your change log.

  6. Test sign-in with a non-administrator account

    Sign in as a standard user, not an administrator, using a test account in the realm. Check that Rocket.Chat creates or links the account, that the email address and username match the Keycloak profile, and that the user lands in the expected workspace with the right default roles. Repeat the test for a second account if your realm uses groups that you plan to map later. If the email address or username does not match, correct the mapper before continuing. Record the results so the test can be repeated after upgrades.

  7. Confirm sign-out returns to Keycloak

    Sign out of Rocket.Chat and confirm that the session ends and the browser returns to the Keycloak sign-in page, not to a Rocket.Chat-only login form. Then sign in again to confirm that the single sign-on flow still works after logout. Check that a session revoked in Keycloak also ends access to Rocket.Chat within the time your session settings allow. Confirm that this behavior is recorded in your test notes before you enable SSO for all users.

  8. Plan the operator update approach

    If Keycloak runs on Kubernetes through the Keycloak Operator, set the Operator's update approval to manual, as the Operator documentation strongly recommends, so that a new Operator version does not upgrade Keycloak without review. Test each Keycloak minor release against the Rocket.Chat sign-in flow in a non-production realm before you promote it. Confirm that your runbook names who approves each update and where the test results are stored. Keep client definitions in version control so the configuration can be rebuilt after an upgrade.

Mapping Keycloak attributes and groups to Rocket.Chat accounts

This table compares the Keycloak attributes and token or assertion values that Rocket.Chat needs to create and match user accounts, with the failure to expect when each is missing. Read the claim names as planning targets, not final configuration: confirm the exact names and mapping options in the Rocket.Chat SSO documentation for your installed version. Group-based role or user group mapping depends on a paid plan, so check the pricing page before you design around it.

Keycloak sourceRocket.Chat account fieldRequired or optionalFailure if missing
Username (preferred_username or equivalent claim)UsernameRequiredLogin may fail or create duplicate accounts if the same person maps to different usernames
Email claim (email, verified in Keycloak)Email addressRequiredAccount creation or email-based matching fails, and password reset and notifications stop working for that user
Given name and family name, or full name claimDisplay nameOptionalUsers appear by username only, which can make channel member lists harder to read
Email verified flagEmail verification statusRequiredAccounts may be blocked or left unverified depending on your Rocket.Chat email settings
Stable subject identifier (sub)External identity linkRequiredRenaming a user in Keycloak can orphan the existing Rocket.Chat account and its message history
Group or role claim in the token or SAML assertionRole assignmentOptional, paid plan for group mappingUsers receive default roles, so admins must assign permissions by hand
Group claim used for user group mappingUser group membershipOptional, paid planGroup-based channel or team membership is not applied at sign-in and must be managed manually

Security settings for the Keycloak connection

The Keycloak connection carries every Rocket.Chat sign-in, so the trust between the two systems is only as strong as their weakest setting. The cards below cover transport, secrets, redirect targets, MFA, administrator access and supported releases, and they are the checks to confirm before the integration goes live.

Enforce TLS on every endpoint

Serve Keycloak, the Rocket.Chat site and the metadata or token endpoints only over HTTPS, with certificates issued for the exact hostnames each system uses. Confirm that Rocket.Chat rejects plain HTTP callbacks and that the SAML or OIDC endpoints in both systems point to HTTPS addresses. Keycloak's production configuration guidance covers hostname and proxy settings that affect whether generated URLs use HTTPS, so check those before go-live. Ask your team who owns certificate renewal for each hostname.

Keycloak production guide

Protect and rotate client secrets and certificates

For OpenID Connect, the client secret lets Rocket.Chat exchange codes for tokens. For SAML, the signing certificate and its private key prove that assertions came from Keycloak. Store both in a secrets manager or sealed Kubernetes secret, never in plain configuration files or chat logs. Set a rotation schedule, record who holds the key material, and plan a rotation window in which Keycloak and Rocket.Chat both accept the old and new values.

Restrict redirect URIs to exact hostnames

Register each Rocket.Chat callback URL in the Keycloak client as a full, exact value instead of a wildcard or broad path pattern. A loose redirect pattern lets an attacker who controls a related path receive authorization codes. Review the list after every hostname change, remove test or staging entries from production realms, and keep web origins equally narrow so that cross-origin requests are limited to the Rocket.Chat domain.

Enable MFA in Keycloak

Rocket.Chat does not need its own second factor for users who sign in through Keycloak if the required authentication flow in Keycloak already enforces one. Configure an OTP or WebAuthn step in the browser flow used by the Rocket.Chat client, then test a login with a user who has no second factor enrolled to confirm enrollment is required. Rocket.Chat's own MFA settings still apply to accounts that sign in with a local password, so review both paths.

Limit Keycloak administrator access

Keycloak's administrative console can change client secrets, redirect URIs, mappers and user roles, so a compromised admin account can alter the whole sign-in path for Rocket.Chat. Keep the master realm for platform administrators only, create a separate realm for workforce users, give most staff read-only or realm-scoped roles, and require MFA for every admin account. Keep an audit of who changed the Rocket.Chat client and when.

Monitor failed logins and keep versions supported

Keycloak exposes metrics that can feed dashboards and alerts, so watch for spikes in failed logins against the Rocket.Chat client as an early sign of password spraying or misconfiguration. Pair monitoring with a patch routine: confirm the Keycloak release and Rocket.Chat version are still within their support windows, because unsupported Rocket.Chat versions lose cloud services and may stop working with official clients. Ask your team which Keycloak release line you will follow and who approves upgrades.

Standard release support
6 months
Rocket.Chat version durability

Common failures in Keycloak SSO for Rocket.Chat

This table lists the symptoms teams most often see when Rocket.Chat is wired to Keycloak, with the likely cause and the fix for each. Read it while testing a login, then confirm the exact setting names in the Rocket.Chat version you run, because menus and keys change between releases.

SymptomLikely causeFix
Keycloak login returns an invalid redirect or redirect URI errorThe Rocket.Chat site URL in Keycloak does not match the public hostname users browse to, including scheme and portSet the valid redirect URI and web origins in the Keycloak client to the exact public Rocket.Chat address, then retest from a clean browser session
Signature or certificate validation fails after a SAML loginThe IdP certificate in Rocket.Chat is expired, from a different realm, or was rotated in Keycloak without re-importExport the current realm signing certificate from Keycloak, replace it in the Rocket.Chat SAML settings, and confirm the entity ID matches the Keycloak client
Users are redirected back to login with no account createdThe email attribute is not mapped or not sent, so Rocket.Chat cannot create the accountAdd an email attribute mapper in Keycloak for the client scope, make email a required user field, and test with a new user whose profile includes email
Login fails for a user who already has a local Rocket.Chat accountA username or email collision with an existing local account that Rocket.Chat does not merge automaticallyDecide ahead of cutover which identity is authoritative, rename or link the duplicate account, and confirm the merge behavior in your Rocket.Chat version
Tokens are rejected as not yet valid or expired immediately after issueClock skew between the Keycloak nodes, the Rocket.Chat servers or the browser environmentSynchronize all servers with NTP, check time on each Keycloak cluster node and Rocket.Chat container host, then retest the login flow
Logins fail or sessions drop after a Keycloak pod or node restartsKeycloak is running on the development file database or a database not set up for productionMove Keycloak to a supported production database with synchronous replication for any clustered design, and follow the production configuration guide before go-live
SSO option is missing, or group and role mapping features do not appearThe Rocket.Chat version is outside vendor support, or the feature requires a paid planCheck the version durability page for your release, plan upgrade within a supported line, and confirm in the plans page which mapping features your license covers
Mobile or desktop clients cannot connect after SSO changesThe Rocket.Chat server runs an end-of-life version that no longer supports the official clientsUpgrade to a supported release line before troubleshooting client sign-in, then retest each client type against the upgraded server

Questions buyers ask before connecting Keycloak to Rocket.Chat

How much effort does a Keycloak to Rocket.Chat SSO integration take?

Effort depends mostly on how many moving parts you already have, not on the sign-in step itself. A basic SAML or OpenID Connect login with one realm, one client and a verified email attribute is a small build. Effort grows with protocol choice (SAML needs certificate exchange, OpenID Connect needs client secrets and redirect URIs), the number of applications already in Keycloak, the attribute and group mappers you need, and how MFA and certificate rotation are handled in Keycloak. Ask your partner to split the quote into identity design, Keycloak configuration, Rocket.Chat configuration, testing and handover so each driver is visible.

Can our team connect Keycloak to Rocket.Chat without outside help?

Yes, a team with Keycloak and Rocket.Chat administration experience can do the basic connection using the documented steps. The risk sits in the details: email attributes that Rocket.Chat requires to match accounts, group or role mapping that may depend on a paid plan, and certificate or client settings that break silently after a change. Teams without recent experience on either side often benefit from outside review of the mapping design and a test plan before users are moved over.

What access and inputs do we need to provide?

You need administrative access to the Keycloak realm that will issue sign-ins, administrative access to the Rocket.Chat workspace, and a named test user set that covers each role and group you plan to map. Also plan a change window, since Rocket.Chat login settings and Keycloak clients are changed in production. Confirm who owns the certificates or client secrets, where they will be stored, and who approves the final attribute mapping. Missing any of these usually adds rework rather than extra build time.

What drives the timeline for this integration?

The timeline is driven by decisions and approvals more than by configuration commands. The main drivers are how quickly you settle the attribute and group design, whether Keycloak already has a realm and clients for Rocket.Chat, how many test users and roles must be verified, how long your change process takes, and whether MFA policy changes need security sign-off. Ask for a schedule that lists these approval points explicitly. Avoid accepting a duration that does not name them.

Do we need a paid Rocket.Chat plan for group mapping?

Single sign-on itself is included in the free Starter plan, which allows up to 50 users. The Rocket.Chat plans documentation lists SSO and multi-factor authentication on Starter, but LDAP and SAML user group mapping is listed on the paid plans. If your design depends on mapping Keycloak groups or roles to Rocket.Chat roles, confirm the exact feature set against the current plans page before you commit. Paid plans are priced by quote, so ask for a written quote based on your user count, deployment model and the features you need.

How do Keycloak or Rocket.Chat upgrades affect the connection?

Upgrades can change the connection, so they should be tested against it. Keycloak releases on a regular cadence and says breaking changes in minor releases are opt-in, but your realm, clients and mappers still need checking after an upgrade. Rocket.Chat standard releases are supported for 6 months and LTS releases for 12 months, and an unsupported version can also lose connections to the official mobile and desktop clients. Plan a test realm and a staging Rocket.Chat instance, and schedule SSO retests with each upgrade of either product.

Does Keycloak need high availability before we connect Rocket.Chat?

Not always, but the answer depends on how much you rely on sign-in. If Keycloak is down, users cannot sign in to Rocket.Chat through SSO. Keycloak documents a single cluster option, a multi-cluster design without external Infinispan, and a deprecated multi-cluster v1 design, and both supported designs need a synchronously replicated database. Decide the availability target with your identity team before the build, because it changes the database and hosting work that sits beside the Rocket.Chat configuration.

How DeployOpen scopes and delivers Keycloak SSO for Rocket.Chat

DeployOpen plans, implements, tests and documents the Rocket.Chat and Keycloak connection inside your own infrastructure, so your identity team can review each step. Engagements are fixed-scope, with the protocol choice, plan requirements and handover agreed in writing before build work starts.

How we scope

  • Confirm your Rocket.Chat plan and version, since group and role mapping depends on the plan tier.
  • Choose SAML or OpenID Connect and document the reasons against your Keycloak realm and client policies.
  • Record email attribute requirements, login flows, MFA expectations and which users keep local accounts.

How we build

  • Set up the Keycloak client, certificate exchange or redirect URIs, and attribute mappers for the chosen protocol.
  • Configure Rocket.Chat SSO settings and test the sign-in path with pilot accounts before wider rollout.
  • Verify failure cases such as missing email claims, expired sessions and users without a matching identity.

How we hand over

  • Deliver configuration records, realm and client exports, and a runbook for changing mappings safely.
  • Document the upgrade checks to repeat when Rocket.Chat or Keycloak versions change.
  • Walk your administrators through the test results and the open items agreed in the written scope.

How we support

  • Support ongoing changes such as new groups, certificate rotation and Keycloak upgrades under a retainer.
  • Retest sign-in after each Rocket.Chat or Keycloak upgrade and report any changed behavior.
  • Ask any provider for a written quote tied to the scope, including who handles certificate renewal.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.