RealmDeployDocs
GuidesIdentity providers

Connect Okta to Keycloak

Broker Okta logins into your Keycloak realm over OpenID Connect, with Okta's groups claim mapped to Keycloak groups.

Users choose Okta on your Keycloak login page, sign in with Okta, and come back to your app with a Keycloak token. Keycloak talks to Okta over OpenID Connect; your apps keep talking only to Keycloak.

Checked against the Okta docs and Keycloak 26.8 on 25 November 2026.

Replace auth.example.com with your RealmDeploy hostname, acme with your realm and example.okta.com with your Okta domain (or your Okta custom domain). The guide uses okta as the identity provider alias, so the redirect URI is https://auth.example.com/realms/acme/broker/okta/endpoint.

Keycloak calls Okta from your tenant: it redeems the login code at Okta's token endpoint, downloads Okta's signing keys (JWKS) and reads the user info endpoint, all on your Okta domain, port 443. Outgoing connections from your tenant are closed by default. Tell us your Okta domain through How to reach us before you test, and we open it.

Which Okta authorization server

Okta has two kinds of authorization server:

Org authorization serverCustom authorization server (default)
Issuerhttps://example.okta.comhttps://example.okta.com/oauth2/default
Discoveryhttps://example.okta.com/.well-known/openid-configurationhttps://example.okta.com/oauth2/default/.well-known/openid-configuration
Groups claimSet on the app's Sign On tab, in the ID tokenAdded on the server's Claims tab
NeedsNothing extraOkta API Access Management in production orgs

Keycloak only needs Okta's ID token to sign the user in, so this guide uses the org authorization server. Okta's tokens are never sent to your apps; your apps get Keycloak's tokens.

In Okta

Create the app integration

  1. In the Admin Console, go to Applications and Resources → Applications and choose Create App Integration, then Classic experience.
  2. Select OIDC - OpenID Connect as the Sign-in method and Web Application as the application type. Choose Next.
  3. Fill in:
FieldValue
App integration nameKeycloak acme
Grant typeAuthorization code only
Sign-in redirect URIshttps://auth.example.com/realms/acme/broker/okta/endpoint
Sign-out redirect URIshttps://auth.example.com/realms/acme/broker/okta/endpoint/logout_response
AssignmentsLimit access to selected groups, then pick the groups that may sign in
  1. Choose Save. On the General tab, under Client Credentials, copy the Client ID. Keep Client authentication on Client secret and copy the secret.

Keycloak sends users to the sign-out redirect URI after it signs them out of Okta, so that URI must be listed.

Add the groups claim

  1. On the app's Sign On tab, choose Edit in the OpenID Connect ID Token section.
  2. Keep Group claim type on Filter. In Group claims filter, keep the name groups, choose Matches regex and enter .*. To send only some groups, use a narrower expression, for example ^keycloak-.*.
  3. Choose Save, then Back to applications, and choose Refresh Application Data from the More menu.

The org authorization server puts groups in the ID token only when the request asks for the groups scope. Keycloak sends it once you set Scopes below. The ID token Keycloak gets is the full one from the authorization code flow, so the groups are in it.

In Keycloak

Add the identity provider

  1. Open Identity providers and choose OpenID Connect v1.0 (from the list, or under Add provider).
  2. Fill in the form and choose Add:
SettingValue
Aliasokta
Display nameOkta
Use discovery endpointOn
Discovery endpointhttps://example.okta.com/.well-known/openid-configuration
Client authenticationClient secret sent as HTTP Basic authentication
Client IDThe Okta Client ID
Client SecretThe Okta client secret

Check the imported settings

On the provider's Settings tab, check these and choose Save:

SettingValue
Issuerhttps://example.okta.com
Validate SignaturesOn
Use JWKS URLOn
Logout URLhttps://example.okta.com/oauth2/v1/logout (imported)
Scopes (under Advanced)openid profile email groups
Send 'id_token_hint' in logout requests (under Advanced)On (the default). Okta needs it to end the session.
Backchannel logout (under Advanced)Off, so logout runs through the browser
Trust Email (under Advanced settings)Off unless every Okta account's email is verified and owned by your organization
Sync mode (under Advanced settings)Force, so names, email and groups update at every login

The OIDC discovery viewer shows Okta's endpoints if you want to compare.

Groups and roles

Okta sends group names in the groups claim. Map each group you need with its own mapper:

  1. Create the target group under Groups, for example engineering.
  2. Open Identity providers → okta → Mappers and choose Add mapper:
FieldValue
Nameokta-engineering
Sync mode overrideInherit
Mapper typeAdvanced Claim to Group
ClaimsKey groups, value Engineering (the Okta group name, case-sensitive)
Regex Claim ValuesOff
Groupengineering

To grant a role instead, use Claim to Role with Claim groups, Claim Value the Okta group name, and the Role.

Group names in Okta can be renamed. When you rename a group in Okta, update the mapper too. With Sync mode Force, Keycloak re-checks the claim at every login and removes the user from the Keycloak group when the claim no longer matches.

Your apps see the groups in Keycloak's tokens once their client has a Group Membership mapper (Client scopes → <client-id>-dedicated → Configure a new mapper).

At the first login, Keycloak links accounts as described in first login and account linking. After that, the link is Okta's sub claim.

Test it

  1. In a private browser window, open https://auth.example.com/realms/acme/account and choose Okta.
  2. Sign in with a user from an assigned group. You come back to the account console, signed in.
  3. In the admin console, open Users, find the user and check the Identity provider links and Groups tabs.
  4. Sign out from the account console. Keycloak sends you to Okta's logout and back.

Common errors

ErrorCauseFix
Okta says the redirect_uri must be a sign-in redirect URI in the client app settingsThe URI in Okta differs from the one Keycloak sends.Copy the Redirect URI from the Keycloak provider page into Sign-in redirect URIs. The redirect URI matcher shows the difference.
Okta says the user is not assigned to the client applicationThe user is not in a group assigned to the app.Assign the user or one of their groups to the app.
Keycloak shows Unexpected error when authenticating with identity provider after the Okta sign-inThe outgoing connection to your Okta domain is not open yet, or the client secret or client authentication method is wrong.Tell us the domain through How to reach us. Check the secret.
Group mapper adds nothinggroups is missing from Scopes, the filter does not match the group, or the group name differs in case.Fix the scope and the filter; copy the group name exactly.
Logout from Keycloak stops on an Okta error pageThe sign-out redirect URI is not listed in Okta.Add https://auth.example.com/realms/acme/broker/okta/endpoint/logout_response.

The OAuth error lookup explains standard OAuth error codes.

FAQ

Can I use the custom authorization server instead?

Yes, if your org has it. Use its discovery URL and issuer from the table above, and add the groups claim on Security → API → (your server) → Claims → Add Claim with Include in token type set to ID Token and Always, Value type Groups and a filter. If Okta answers that a scope is not configured, add groups to the server's scopes or remove it from Scopes in Keycloak.

Do Okta's MFA policies still apply?

Yes. Keycloak hands the sign-in to Okta, so Okta's sign-on policies run as usual. If you want Keycloak to ask for a second factor as well, set a Post login flow on the provider.

Can users skip the Keycloak login page?

Yes. Add kc_idp_hint=okta to the app's login request; the identity provider redirect builder writes the URL. Or make okta the default identity provider in the browser flow's Identity Provider Redirector.

Sources

On this page