Keycloak Add Okta As an External Identity Provider

Published
Length
3 min read

Luis Felipe Dias

All posts

To make keycloak add okta as an external identity provider, link both tools with OpenID Connect or SAML. You register Keycloak as a client in Okta, then copy the client keys and URLs back into Keycloak. Teams use this setup so staff can log in with one main corporate account. Still, mapping broad groups between both tools often gives users too many permissions on backend systems. How to make keycloak add okta as an external identity provider First, you create a new app integration inside your

Keycloak + Okta Workforce Identity: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

To make keycloak add okta as an external identity provider, link both tools with OpenID Connect or SAML. You register Keycloak as a client in Okta, then copy the client keys and URLs back into Keycloak. Teams use this setup so staff can log in with one main corporate account. Still, mapping broad groups between both tools often gives users too many permissions on backend systems.

How to make keycloak add okta as an external identity provider

First, you create a new app integration inside your Okta admin panel. You pick OpenID Connect or SAML based on your security rules. Next, you copy the callback URL from your Keycloak realm into the Okta app. This URL tells Okta where to send the user after a good login. Okta then gives you a client ID, a client secret, and an issuer URL.

You take those three values and paste them into the Keycloak identity provider form. Keycloak uses the issuer URL to find the public keys and login endpoints in Okta. When a user tries to log in, Keycloak sends their browser over to Okta. Okta checks the user password and runs any required multi-factor checks.

Once Okta finishes the check, it sends a signed token back to Keycloak. Keycloak reads this token and creates a local user profile if one does not exist. You can also set up mappers in Keycloak to read group claims from the Okta token. These mappers turn Okta groups into local Keycloak roles for your internal apps.

Why role mapping is hard to keep tight

Syncing groups from Okta into Keycloak makes user login much simpler for your team. When someone leaves the company, you disable their Okta account to stop new logins. The problem starts when you map broad Okta groups to database or server roles. Most teams map an entire engineering group to a single shared admin role.

Keycloak and Okta only check who the user is at the moment of login. Once a user gets past the login screen, the identity provider steps out of the way. If a developer logs into a production database, Okta does not see the SQL queries they run. If an engineer opens a shell on a server, Keycloak does not inspect their commands.

Static role mappings also stay active all day long. A user who needs write permissions for ten minutes keeps those permissions for weeks. Also, native identity providers cannot mask sensitive fields like emails, phone numbers, or card numbers in query results. You know who logged in, but you do not control what their requests do in flight.

Keycloak + Okta Workforce Identity: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Best practices for linking Okta and Keycloak

Start by keeping your Okta group claims as narrow as possible. Do not send every group a user belongs to inside the login token. Filter the group list so Okta only sends groups relevant to your technical systems. This keeps the token small and prevents accidental role matches inside Keycloak.

Next, set short token lifetimes inside your Keycloak realm settings. Short lifetimes force Keycloak to check the user status with Okta more often. If an admin revokes a user in Okta, the active Keycloak session expires soon after. You should also review your identity provider mappers every quarter to remove old role links.

Finally, separate app login from direct database and server permissions. Use Okta and Keycloak to prove user identity, then enforce granular rules at the command level. When you pair identity checks with runtime controls, you stop bad queries before they run. Masking rules can also rewrite national IDs and card numbers in query results by default.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev sits inline in the protocol beside each supported service as an open-source proxy, a sidecar for your database or API. For every query or command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human approval.

First, hoop.dev guardrails block banned queries before they run or hold risky ones for review, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

OpenID Connect is usually easier to set up and works well with modern web apps. SAML is a good choice if your company already relies on XML metadata files for older systems.

How do Okta groups become Keycloak roles?

You configure Okta to include a groups claim inside the login token. Then you create an identity provider mapper in Keycloak that assigns a specific role when that group name appears.

What happens in Keycloak when a user is deactivated in Okta?

The user cannot start any new login sessions through Okta right away. Still, their current Keycloak session remains active until the local access token expires or an admin revokes it.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.