Introduction
In this article, we demonstrate how to use Okta as a SAML Identity Provider (IdP) and configure Keycloak as a SAML Service Provider (SP) using Keycloak’s Identity Brokering feature.
With this setup, your applications—whether OIDC or SAML—can authenticate users stored in Okta through Keycloak, without modifying application code.
Brief Overview of SAML
What is SAML?
Security Assertion Markup Language (SAML) is an XML-based framework that enables identity and authentication information to be securely exchanged between online business partners.
For more details you may visit official documentation available here.
In SAML:
- Identity Provider (IdP): where the user authenticates (in our case: Okta)
- Service Provider (SP): the relying party that consumes authentication assertions (in our case: Keycloak)
The IdP issues SAML Assertions, which are signed XML documents containing:
- Authentication information
- Optional user attributes
- Optional authorization data
SAML Flows
SAML supports two main flows:
- SP-Initiated Flow
- IdP-Initiated Flow
In this article, we focus on the SP-Initiated Flow.
Because Keycloak is the SP, users will start authentication from the Keycloak login page by clicking “Sign in with Okta”.
How SP-Initiated Authentication Works
- User navigates to Keycloak-protected application -> redirected to Keycloak login page.
- User clicks “Sign in with Okta”.
- Keycloak (SP) generates a SAML Authentication Request.
- The request is sent through the browser to Okta.
- Okta identifies the registered SP configuration.
- Okta prompts the user to authenticate (password, MFA, etc.).
- After successful authentication, Okta creates a session.
- Okta generates a signed SAML Assertion.
- Okta sends the assertion to Keycloak via HTTP POST binding.
- Keycloak validates the XML signature using Okta’s public certificate.
- If valid, Keycloak creates (or maps) a local user automatically.
- The user session is established, and the user is logged in to Keycloak.
- Keycloak redirects the user to the application.
Configuration Steps
Configuration Steps
The configuration involves two main parts:
- Configure Okta (as SAML IdP)
- Configure Keycloak (as SAML SP)
Part 1: Configure at Okta as SAML IDP
Step 1: Log in to Okta console and choose a SAML application
Go to:
- Navigate to:
Applications → Applications → Create App Integration - Choose:
- Sign-in method: SAML 2.0
- Click Next.
Step 2: Configure SAML settings
In General Settings:
- App Name: kc-client
Click Next.
Step 3: Configure SAML – SAML settings
Fill the following fields:
Single Sign-On URL (Assertion Consumer Service – ACS URL)
Use Keycloak’s SAML broker ACS URL:
https://<skycloak-domain>/realms/<realm-name>/broker/<idp-alias>/endpoint
Substitute at the above place holders with actual Skycloak host name , realm name. For idp_alias give as okta
select checkbox – Use this for Recipient URL and Destination URL
Audience URI(SP Entity ID)
Use Keycloak’s broker Entity ID:
https://<skycloak-domain>/realms/<realm-name>
Substitute at the above place holders with actual Skycloak host name , realm name
Name ID Format
Unspecified
This ensures Okta sends the Okta username in the SAML NameID (recommended if you want username-based mapping).
Click Next -> Finish.
Go to:
Assignments ->Assign People -> Add users
Assign test users to the application.
Step 3: Copy the metadata URL
Go to:
Sign-On -> Metadata details -> Copy the Metadata URL
You will use this URL in Keycloak.

Part 2: Configure Keycloak as SP
Step 1: Add Okta as a SAML Identity Provider
- Log in to Keycloak Admin Console.
- Navigate to: Identity Providers -> Add provider -> SAML v2.0
- Provide: Alias as okta
Import metadata from URL
Paste the metadata URL you copied from Okta.
Click Show metadata for Import.
This automatically fills:
- SSO URL (SingleSignOnService)
- SLO URL
- IdP public certificate
Step 2: Verify Redirect URI
The Redirect URI displayed by Keycloak must match the ACS URL you provided in Okta
https://<skycloak-domain>/realms/<realm-name>/broker/okta/endpoint
If correct -> proceed.
Step 3: Save the Identity Provider
Click Add to save
Testing the Integration
- Open a Keycloak-protected application or visit the Keycloak account console.
- At the login page, click “Sign in with Okta”.
- Authenticate at Okta.
- Okta returns a signed SAML Assertion.
- Keycloak logs you in and creates a user entry using the NameID (Okta username).
- Attributes like email, first name and last name we have not populated in this article. Hence Keycloak will prompt you to enter them on first login.
Summary
In this article, we configured:
- Okta as a SAML Identity Provider
- Keycloak 26.x (Skycloak) as a SAML Service Provider
- ‘SP-initiated login flow from Keycloak
- User mapping based on NameID = Okta username
Skycloak provides production-ready managed Keycloak hosting, helping teams avoid the complexity of maintaining and scaling Keycloak themselves.
If you’re new to Skycloak, visit the Skycloak Getting Started Guide to learn more.