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 server | Custom authorization server (default) | |
|---|---|---|
| Issuer | https://example.okta.com | https://example.okta.com/oauth2/default |
| Discovery | https://example.okta.com/.well-known/openid-configuration | https://example.okta.com/oauth2/default/.well-known/openid-configuration |
| Groups claim | Set on the app's Sign On tab, in the ID token | Added on the server's Claims tab |
| Needs | Nothing extra | Okta 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
- In the Admin Console, go to Applications and Resources → Applications and choose Create App Integration, then Classic experience.
- Select OIDC - OpenID Connect as the Sign-in method and Web Application as the application type. Choose Next.
- Fill in:
| Field | Value |
|---|---|
| App integration name | Keycloak acme |
| Grant type | Authorization code only |
| Sign-in redirect URIs | https://auth.example.com/realms/acme/broker/okta/endpoint |
| Sign-out redirect URIs | https://auth.example.com/realms/acme/broker/okta/endpoint/logout_response |
| Assignments | Limit access to selected groups, then pick the groups that may sign in |
- 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
- On the app's Sign On tab, choose Edit in the OpenID Connect ID Token section.
- 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-.*. - 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
- Open Identity providers and choose OpenID Connect v1.0 (from the list, or under Add provider).
- Fill in the form and choose Add:
| Setting | Value |
|---|---|
| Alias | okta |
| Display name | Okta |
| Use discovery endpoint | On |
| Discovery endpoint | https://example.okta.com/.well-known/openid-configuration |
| Client authentication | Client secret sent as HTTP Basic authentication |
| Client ID | The Okta Client ID |
| Client Secret | The Okta client secret |
Check the imported settings
On the provider's Settings tab, check these and choose Save:
| Setting | Value |
|---|---|
| Issuer | https://example.okta.com |
| Validate Signatures | On |
| Use JWKS URL | On |
| Logout URL | https://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:
- Create the target group under Groups, for example
engineering. - Open Identity providers → okta → Mappers and choose Add mapper:
| Field | Value |
|---|---|
| Name | okta-engineering |
| Sync mode override | Inherit |
| Mapper type | Advanced Claim to Group |
| Claims | Key groups, value Engineering (the Okta group name, case-sensitive) |
| Regex Claim Values | Off |
| Group | engineering |
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
- In a private browser window, open
https://auth.example.com/realms/acme/accountand choose Okta. - Sign in with a user from an assigned group. You come back to the account console, signed in.
- In the admin console, open Users, find the user and check the Identity provider links and Groups tabs.
- Sign out from the account console. Keycloak sends you to Okta's logout and back.
Common errors
| Error | Cause | Fix |
|---|---|---|
Okta says the redirect_uri must be a sign-in redirect URI in the client app settings | The 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 application | The 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-in | The 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 nothing | groups 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 page | The 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
- Keycloak Server Administration Guide: OpenID Connect v1.0 identity providers, mappers, first login flow and post login flow
- Keycloak source 26.8.1: OIDCIdentityProvider (logout redirect and
logout_responseendpoint) - Okta: Create OIDC app integrations
- Okta: Customize tokens returned from Okta with a groups claim
- Okta: Authorization servers
Connect Google Workspace to Keycloak
Let your Google Workspace users sign in to your Keycloak realm, limited to your own domain, and learn how to bring Google groups along.
Connect GitHub to Keycloak
Let users sign in to your Keycloak realm with GitHub through a GitHub OAuth App, and what to do when only members of one GitHub organization may get in.