Strapi admin SSO with Keycloak: what the integration does
Your editors already hold corporate credentials in Keycloak, and the goal of this integration is to let them sign in to the Strapi admin panel with those credentials instead of a separate Strapi password. This covers administrator login only: an identity provider authenticates the person, and Strapi decides which admin role they receive when they arrive. End-user login on your front end, where customers or staff use the Users and Permissions plugin, is a separate concern with its own provider settings and token handling, so do not assume that one configuration covers both.
Under OpenID Connect, Strapi redirects the editor's browser to Keycloak, Keycloak authenticates the user and sends an authorization code back to a callback URL on your Strapi instance, and Strapi exchanges that code for identity claims it uses to create or match an admin account. The connector named in the topic brief is the passport-keycloak-oauth2-oidc strategy. Confirm the exact option names, the callback path and the auto-registration and default role settings against that package and the Strapi SSO documentation before you write any configuration, because the names differ between strategies and between Strapi releases.
SSO is a paid add-on on the Growth self-hosted plan and is included in Enterprise, according to the Strapi self-hosted pricing page. Confirm with Strapi which plan and license terms apply to your deployment before you commit, since the Community Edition does not include this feature. Budget for the license cost as a recurring item, and for the one-time work of Keycloak client setup, role mapping and testing on both sides.
What you need before configuring Keycloak and Strapi
Admin SSO depends on four things lining up: a supported Strapi 5 project, a Strapi plan that includes SSO, a Keycloak server with a realm you control, and a trusted HTTPS path between the two. Check each card before you touch either configuration, because most failed sign-ins trace back to one of these prerequisites rather than to the login settings themselves.
Strapi 5 on a supported database
Confirm your project runs Strapi 5 on PostgreSQL 14 or later, MySQL 8.0 or later, MariaDB 10.3 or later, or SQLite 3. Strapi 5 does not support MongoDB or other NoSQL databases, so a project built on one needs a database change before SSO work starts. If you are still on Strapi 4, plan the upgrade first, since Strapi 4 reached end of life on April 30, 2026.
Strapi requirementsActive or Maintenance LTS Node.js
Strapi 5 runs only on Active or Maintenance LTS Node.js versions. Check the Node.js release schedule against your planned Strapi release before you pick a runtime, and use the same version in development, staging and production so the admin build behaves the same way everywhere. Record the exact version in your deployment configuration so a later host image update does not change it silently.
A Strapi plan that includes SSO
Admin SSO is an add-on on the Growth self-hosted plan and included in Enterprise. Confirm the plan and any add-on with Strapi before the build, because the Community edition does not include this feature. Ask for the current price in writing, since the listed Growth price covers only the base seats and each extra user adds a fee.
Self-hosted pricingA Keycloak server on a supported database
Run Keycloak 26.8.1, the current release published October 13, 2026, on a production database from the supported list, such as PostgreSQL 14 to 18. The development file database is for testing only. Plan the high availability design and the database replication requirement now, because a login outage on Keycloak blocks every Strapi admin session that depends on it.
Keycloak database guideA dedicated realm and administrator
Create a realm for the editors who will sign in to Strapi rather than reusing the default master realm, which holds Keycloak's own administration. Give yourself a named administrator in that realm with multi-factor authentication enabled, and keep a second break-glass administrator documented offline. Decide who owns client changes after go-live so the redirect settings are not edited by whoever is on call.
HTTPS and network reachability
Serve the Strapi admin host and the Keycloak login page over HTTPS with a certificate that the Strapi admin host trusts, including any internal certificate authority. Confirm that the Strapi server can reach Keycloak's OpenID Connect discovery endpoint and that a browser on the editor network can reach both hosts. Test this from the same network segment and proxy path your editors use, not only from your workstation.
Strapi creates or looks up the admin user only after Keycloak confirms the sign-in
The flow starts when an editor opens the Strapi admin panel and chooses Keycloak sign-in. The browser crosses the trust boundary into Keycloak, which authenticates the editor and redirects back to the callback URL on the Strapi server. The server then exchanges the code with Keycloak for tokens and reads user details from the user info step. Strapi looks up the matching admin user by the identity it received, creates one if auto-registration is enabled, and applies the default role. Check that the callback URL registered in Keycloak matches the Strapi URL exactly, and confirm which claims your role mapping depends on before go-live.
Login path from the editor's browser to the Strapi admin user record.
Configuring the Keycloak client and the Strapi provider in order
This sequence produces a confidential Keycloak client that Strapi trusts, a configured admin SSO provider in the Strapi project, and a tested path where Keycloak users sign in to the admin panel with the role you chose. Each step ends with a check so you can stop and fix problems before the next one.
Choose or create the Keycloak realm
The Keycloak administrator decides whether editors live in an existing realm or in a new realm dedicated to Strapi. Keep the realm that holds your workforce accounts separate from any realm used for end-user customers, so admin access is governed by one directory. Confirm that the editor accounts you plan to test exist in this realm, are enabled, and have a verified email address. The step is done when the realm name is recorded and at least one test editor can sign in to the Keycloak account console.
Create a confidential OpenID Connect client
In the Keycloak admin console, create an OpenID Connect client for the Strapi admin panel and set client authentication to on so it is a confidential client with a secret. Enable the standard authorization code flow and leave direct access grants off unless you have a specific need. Record the client ID and the client secret in your secret store, not in the repository. The step is done when the client appears in the realm with client authentication enabled and the secret is stored where your deployment tooling can read it.
Set the valid redirect URI to the Strapi callback
Set the valid redirect URI on the client to the admin callback URL of your Strapi instance, using the exact scheme, host, port and path that users will hit in the browser. Confirm the exact path in the Strapi SSO documentation for your Strapi 5 version, because a mismatch produces redirect errors that look like login failures. Limit web origins to the admin domain. The step is done when a browser opening the Strapi login page reaches the Keycloak sign-in screen without a redirect URI error.
Install the passport strategy in the Strapi project
A developer installs the passport-keycloak-oauth2-oidc package in the Strapi project and confirms the package version against its documentation and the Strapi SSO docs before committing the lockfile. The strategy is loaded by the Strapi admin SSO configuration, so the developer also checks that the Strapi build and start commands pick it up in development and in the container image. The step is done when the project builds locally with the dependency installed and the lockfile change is committed.
Add the provider settings from environment variables
The developer adds the provider settings to the Strapi configuration, using the key names confirmed in the package README and the Strapi SSO docs for this strategy. Supply the Keycloak issuer or discovery values, the client ID and the client secret through environment variables, and keep the secret out of version control. Confirm each key name against the package documentation rather than copying names from older examples. The step is done when Strapi starts with the provider enabled and the admin login page shows the Keycloak option.
Enable auto-registration and set the default admin role
Turn on auto-registration so a first-time Keycloak editor gets an admin account on sign-in, and set the default role to the least-privileged role that lets the person do their job, usually a restricted editor role rather than Super Admin. Map roles deliberately in the Strapi admin role settings and review them against your admin role design. Test with a new Keycloak user, then confirm the account created in Strapi has the expected role. The step is done when a new test editor signs in and the Strapi admin user record shows the default role you set.
Decide on local login as a fallback and test sign-in
Decide whether the local email and password login stays available. Keeping it gives you a recovery path if Keycloak is unavailable, but it also gives attackers a second sign-in route, so many teams keep one named break-glass admin and lock local login for everyone else. Document the decision and who can use the fallback. Then run three tests in a private browser session: a successful sign-in from a test account, a rejected sign-in for a disabled Keycloak user, and confirmation that the admin account and role match your expectations. The step is done when all three checks pass and the fallback decision is recorded.
How Keycloak users and groups map to Strapi admin roles
This table compares each Keycloak user attribute, group or role and the Strapi field or behavior it drives, with the setting that controls it and what to confirm before go-live. Read it as two lists: what the documented SSO feature does out of the box, and what a group-to-role rule would require as a custom build. The main takeaway is that Strapi's documented SSO sets identity and a default role, and anything more granular needs to be designed, built and tested.
| Keycloak attribute or group | Strapi field or behavior it drives | Setting that controls it | What to confirm |
|---|---|---|---|
| User email | Matches the Strapi admin account identity used at sign-in and at auto-registration | Email mapper in the Keycloak client scope and the Strapi provider configuration | Email is always present and unique in the realm, and is verified before it is trusted |
| User first and last name | Display name on the Strapi admin user record | Name claims included in the ID token or userinfo response | Which claims your Strapi build reads, and whether editors expect names to sync on every login |
| Username | Not a documented Strapi identifier for admin login; treat as informational | Username claim in the client scope, if you map it at all | Whether your team relies on username anywhere, such as audit logs or support tickets |
| Enabled flag on the Keycloak user | Disabled users in Keycloak should not sign in to Strapi | Keycloak user enabled setting; Strapi admin account status | A test with a disabled Keycloak user confirms that sign-in is refused and that an existing Strapi admin session is ended |
| Group or role membership | Not a documented Strapi feature for role assignment; any rule that picks roles from groups is a custom build | Group or role claim in the token, plus your custom Strapi code | Design, implement and test the rule, including what happens when a user belongs to no group or to several |
| Default role at auto-registration | Role given to a new admin created on first SSO sign-in | Default role and auto-registration options in the Strapi SSO settings | Which role is assigned, that it grants least privilege, and that auto-registration is switched on only when intended |
| Existing Strapi admin accounts | Accounts created with local passwords before SSO was enabled | Local login lock-out option and account linking decisions in your rollout plan | Whether each existing admin links to the Keycloak identity, keeps local login, or is removed, decided per account before rollout |
Choosing where Keycloak runs for admin login
A single Keycloak instance is the simplest way to prove the Strapi admin login flow before production. It suits a time-boxed pilot with a limited group of editors and no expectation of continuous availability. Keycloak's documentation treats the default dev-file database as development only, so a pilot that will later become production should already use one of the supported production databases, such as PostgreSQL 14 to 18, to avoid a migration later.
- Callback URL: Register the Strapi callback URL exactly as Strapi will call it, using the hostname you intend to keep. Changing it later means updating the Keycloak client and the Strapi configuration together.
- Hostname: Give Keycloak a stable public hostname now. Pilot setups often use a laptop or temporary name that leaks into issuer URLs.
- Certificates: Use a certificate chain that Strapi's server trusts. Self-signed certificates tend to break the token exchange in ways that look like Strapi errors.
- Production settings: Follow the production configuration guidance rather than the development start command, so the pilot does not hide problems that production will expose.
Before you extend the pilot, confirm that the hostname, certificate and database choices can be carried into production without rework.
A clustered Keycloak deployment is the usual choice when admin login must keep working through a single node failure. Keycloak documents a single cluster, optionally spread across availability zones, and a multi-cluster design without an external Infinispan cluster. It also documents the multi-cluster v1 design as deprecated. Both supported designs require a database that replicates synchronously, so the database engine and its topology are part of the same decision as Keycloak itself.
- Load balancer hostname: Strapi should point at one stable public name in front of the cluster, so the callback URL does not change when a node is replaced.
- Database support: Confirm the database engine against the Keycloak database guide. The supported list includes PostgreSQL, MySQL, MariaDB, Microsoft SQL Server, Oracle Database and Azure SQL.
- Schema migration: Keycloak migrates the schema at startup by default. For large deployments, the upgrading guide suggests manual migration, so plan who applies the SQL.
- Certificates: Terminate TLS at a layer you can renew without restarting Keycloak, and keep the issuer URL identical across nodes.
- Availability design: Ask your platform team which high availability architecture fits your sites and confirm it against the high availability overview.
Confirm the database replication and the load balancer hostname with your infrastructure team before choosing this model.
The Keycloak Operator manages Keycloak and related custom resources on Kubernetes. Install it through Operator Lifecycle Manager, which the documentation recommends, or with kubectl or an experimental Helm chart. The operator also manages KeycloakRealmImport, KeycloakOIDCClient and KeycloakSAMLClient resources, so the Strapi client can be declared as code. This makes the Strapi client definition reviewable, but it also means a platform change can alter the admin login.
- Declared client: Define the Strapi client as a KeycloakOIDCClient resource so the callback URL is versioned with your manifests.
- Ingress and hostnames: Keep the Keycloak ingress hostname stable across namespaces and clusters, because the Strapi configuration depends on it.
- Manual approval mode: The operator documentation strongly recommends manual approval for operator updates to avoid unintended automatic upgrades. Approve each update after you check the Strapi login in a non-production cluster.
- Secrets: Keep the client secret in your secrets platform and inject it into Strapi, not into the manifest.
- Metrics: Connect Keycloak metrics to your monitoring so a failed login spike is visible.
Before enabling any automatic update path, confirm with your platform team who approves operator upgrades and how a rollback would reconfigure the Strapi client.
Hardening Keycloak admin login before go-live
Keycloak becomes the front door to the Strapi admin panel, so its client, realm and session settings decide who can edit content and for how long. The cards below cover the secrets, URLs, transport, sign-in rules, roles, recovery path and monitoring that should be reviewed together before editors sign in through Keycloak.
Keep the client secret out of code
The Keycloak client secret for the Strapi admin application should live in a secret store or environment injection at deployment, never in the Strapi repository, configuration files committed to Git, or front-end bundles. Confirm that the value is rotated after any suspected exposure and that build logs and container images do not contain it. Because the admin login flow runs on the server, the secret should not reach the browser at all.
Keycloak production guideUse exact callback URLs only
Register the Strapi admin callback URL in the Keycloak client as one exact value, including scheme, host, port and path. Avoid wildcards such as a trailing asterisk or broad domain patterns, since they let an attacker redirect an authorization code to a location they control. Check the valid redirect URI list again after every hostname change, staging copy or reverse proxy update.
Enforce HTTPS end to end
Serve the Keycloak login pages, the Strapi admin panel and the callback endpoint over HTTPS, and make sure the proxy forwards the original scheme and host so that Strapi builds the correct redirect. Mixed schemes are a common source of redirect loops and of tokens sent over plain HTTP. Confirm that cookies are marked secure and that HTTP requests redirect to HTTPS before any editor signs in.
Restrict who can sign in
Control sign-in in Keycloak rather than assuming Strapi will filter users. Limit the realm or client to the users and groups that need editor access, disable self-registration for this realm if it is not needed, and require the sign-in policies your organization uses for workforce accounts. Test with an account that is not in the allowed group to confirm it is refused before Strapi is reached.
Default new admins to the lowest role
When Strapi auto-registers a user on first SSO login, the default role applies immediately. Set that default to the least privileged Strapi admin role that still lets a new person do their starting work, and grant elevated roles by a deliberate change afterward. Document which Keycloak groups map to which Strapi roles so that reviewers can trace access during an audit or offboarding.
Keep a tested local admin path
Strapi SSO can lock out local login, so keep at least one break-glass Strapi administrator account and store its credentials under your normal secret controls. Test the recovery route before go-live by temporarily disabling the Keycloak client in a non-production environment and confirming the local path works. Record who may use it and how each use is reviewed.
Set session and token lifetimes
Review access token, SSO session and idle timeout values in Keycloak against your organization's session policy, since they determine how long a stolen or left-open admin session stays valid. Shorter idle timeouts suit editors on shared workstations, while longer ones reduce re-authentication friction. Confirm the values in the realm settings you actually deploy, not only in the defaults shipped with the release.
Log sign-in events and watch metrics
Enable Keycloak event logging for sign-in, failed login and admin events, and forward them to the log platform your security team already monitors. Expose Keycloak metrics and alert on spikes in failed logins, unexpected client errors and callback failures that could indicate a misconfigured redirect. Confirm who receives the alerts and how often the event retention meets your records requirements.
Keycloak metrics docsHow to test sign-in, lockout and role assignment
Test the auto-registration path first, using a Keycloak user who has never signed in to Strapi. Confirm that the first sign-in creates an administrator account in the Strapi admin panel, that the account receives the default role you configured for SSO users, and that the role grants only the content types and actions you intended. Then test with an existing Strapi administrator whose email address matches a Keycloak account, so you can see how the provider links that identity to the existing record and whether it creates a duplicate. Record the result for each case, because a duplicate account or an unexpected role is much easier to catch in a test than after editors start working. Use the Keycloak role or group mapping you planned for each test user, and check the role shown in the Strapi admin panel against your mapping table, not against what you remember configuring.
Next, test refusal and recovery. Disable a test account in Keycloak and attempt to sign in to the Strapi admin panel through the SSO button. Access should be refused, and the account should not be able to get a session from a cached login. Then test the local login lock-out in both states: with local login locked out, confirm that the admin panel accepts only SSO sign-in; with the lock-out removed, confirm that a local administrator can still sign in. Confirm that a named person on your side knows how to reverse the lock-out before you enable it in production, because recovery depends on it. Ask your partner or internal team to write these checks as a repeatable script or checklist, and keep the results with the change record. Repeat the full set of tests after each Strapi 5 minor upgrade and after each Keycloak upgrade. Keycloak plans four minor releases a year and says breaking changes in a minor release are opt-in, so a configuration that worked last quarter can still change behavior after an upgrade you did not plan to take.
Why Keycloak sign-in to Strapi fails
This table pairs each symptom an editor or administrator sees during Keycloak sign-in to the Strapi admin panel with its likely cause and the setting to check first. Work down the rows in order, since the redirect URI and client secret are the most frequent causes. The main takeaway is that most failures trace to a mismatch between the Keycloak client and the Strapi configuration, so compare those two settings before changing anything else.
| Symptom | Likely cause | Fix |
|---|---|---|
| Keycloak shows an "invalid redirect URI" error | The callback URL registered on the Keycloak client does not match the URL Strapi sends | Compare the valid redirect URIs on the Keycloak client with the Strapi callback URL, including scheme, host, port and path. Copy the exact value from the Strapi SSO settings. |
| Sign-in succeeds at Keycloak but Strapi returns an authentication error | The client secret in Strapi is wrong, stale or copied with extra whitespace | Regenerate or copy the client secret from the Keycloak client credentials tab, then update the secret in your environment variables and restart Strapi. |
| Login loops back to the Keycloak page or the browser reports a mixed content error | Strapi is generating HTTP URLs while Keycloak and the browser use HTTPS, or the reverse | Check the public URL and proxy headers set for Strapi and the Keycloak frontend URL. Both must use the scheme that users actually reach through the reverse proxy. |
| Strapi cannot reach the Keycloak discovery endpoint in its logs | The Strapi server does not trust the certificate chain of the Keycloak server, often an internal certificate authority | Add your internal root or intermediate certificate to the trust store used by the Node.js process on the Strapi host. Confirm the Keycloak hostname matches the certificate name. |
| Strapi denies access with a message that no email is available | The Keycloak user has no email attribute, so Strapi cannot create or match an admin account | In Keycloak, open the user profile and set a verified email address, and check that the email scope is included in the client's default scopes. |
| Editor signs in but sees an empty or restricted admin panel | The default role assigned on auto-registration lacks permissions for the content types the editor needs | Review the default role in the Strapi SSO settings and the permissions for each content type. Assign a role that matches the editor's work, and test with an account in each group. |
| Local administrators cannot log in after SSO was enabled | Local login was disabled before a Keycloak admin login was confirmed to work | Keep at least one tested local super administrator until SSO is proven. Check the local login lock-out setting in Strapi before saving it, and keep a recovery path through the database or a deployment command. |
What does Keycloak SSO for Strapi cost and take?
What drives the cost of Keycloak SSO for Strapi admin login?
The cost follows from the scope agreed in writing, and the largest drivers are the number of admin roles, how many Keycloak realms and clients are involved, and how much testing the setup needs. Two platform costs sit outside any services quote. The first is the Strapi plan: SSO for the admin panel is an add-on on the Growth plan and included in Enterprise, and the self-hosted Growth plan is listed at 45 US dollars per month including 3 users, according to Strapi's self-hosted pricing page. The second is Keycloak hosting, which you pay for in your own infrastructure. A quote should separate the design, build, testing and handover work from these platform costs and state which items are one-time and which recur.
Can our in-house team set up Strapi admin SSO with Keycloak?
Yes, if your team already runs Strapi and Keycloak and has someone comfortable with OpenID Connect settings, callback URLs and role mapping. The work is not large in isolation, but it crosses three areas: the Keycloak client and realm configuration, the passport-keycloak-oauth2-oidc strategy inside Strapi, and the admin role decisions that determine what new sign-ins can do. Teams without recent Keycloak administration experience usually spend most of their time on the failure cases, such as redirect loops and missing claims. Before deciding, check whether you have a test realm, someone who can approve the role model, and a plan for testing sign-in and lock-out before production.
How long does a Keycloak SSO setup for Strapi take?
Duration depends on the steps involved rather than a fixed figure, and each step can be scheduled separately. The sequence is: confirm the Strapi plan and Keycloak version in use, design the realm and client, create the client and callback URL, configure the strategy in Strapi, define how Keycloak groups or roles map to Strapi admin roles, set auto-registration and the default role, test with sample accounts, and then review the local login lock-out before go-live. Time is extended mainly by delays in getting a Keycloak admin, a named approver for role design, or a test environment. Ask any partner to break its plan into these steps with the dependency on each client input.
What do we need to provide before the Keycloak and Strapi work starts?
You need four inputs before the work starts. First, Keycloak admin access, scoped to the realm where the client will be created, so the setup can be made and recorded. Second, a test realm or non-production Keycloak instance, so sign-in and role mapping can be checked without touching real editor accounts. Third, a named approver who can confirm the role model and sign off the default role for new admins. Fourth, a decision on default roles and whether local login stays enabled as a fallback or is locked out. You should also confirm which Strapi version and deployment you run, because the admin SSO settings and plan requirements affect what can be configured.
What recurs after launch, and who handles it?
Several items recur after go-live. Keycloak publishes four minor releases a year and expects breaking changes in minor releases to be opt-in, according to the Keycloak blog from October 2024, so upgrade planning becomes an ongoing task. Strapi 5 minor releases ship roughly weekly, so the strategy package and admin configuration need periodic checks. Client certificates or secrets, if used, need renewal on your schedule. Sign-in flows and role mappings should be retested after each upgrade of either platform. Ask any provider whether these items are covered by a retainer or left to your team, and what each one costs to keep current.
Can the Keycloak SSO setup for Strapi be fixed-scope?
Yes. Most DeployOpen engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts, and a quote follows from that written scope. A fixed-scope agreement for this topic should name the Keycloak version and deployment, the number of realms and clients, the role mapping rules, the test cases, the handover documentation and the retest after changes. Work outside that scope, such as adding a second identity provider or redesigning the Keycloak realm model, would be quoted separately. Ongoing upgrades and continuous testing are available as retainers if you prefer to keep the setup maintained.
Does Keycloak SSO for Strapi need a paid license?
Keycloak is open source under the Apache 2.0 license, so the software itself carries no license fee. Strapi Community Edition is under the MIT Expat license, but admin SSO is a Strapi paid feature: it is an add-on on the Growth plan and included in Enterprise. If you need vendor support for Keycloak, Red Hat build of Keycloak is Red Hat's supported distribution and is a separate subscription, which you should price with Red Hat directly. Confirm which Keycloak distribution and support level your organization needs before comparing quotes.
How DeployOpen scopes and delivers Strapi admin SSO with Keycloak
DeployOpen plans Strapi admin SSO with Keycloak as a fixed-scope engagement in infrastructure you control. The written scope fixes the Keycloak realm and client settings, the Strapi admin login path, role mapping and the tests that show editors reach the right permissions before go-live.
How we scope
- Confirm which Strapi version, Node.js version and database your admin panel runs on before choosing the login approach.
- Record the Keycloak version, hosting model and realm layout that the written scope will cover.
- Agree in writing which Keycloak groups or roles map to Strapi admin roles, and who approves each mapping.
How we build
- Configure the Keycloak OpenID Connect client, redirect URIs and callback URL for each Strapi environment.
- Wire the Strapi admin SSO provider with the passport-keycloak-oauth2-oidc strategy, auto-registration and default role settings.
- Test sign-in, role assignment, denied access and the local login lock-out option in a staging environment first.
How we hand over
- Deliver a written configuration record covering client settings, environment variables without secret values, and role mappings.
- Document the admin onboarding steps and the procedure for changing a user's Strapi role through Keycloak.
- Walk your identity, security and Strapi teams through the setup and the test results before production cutover.
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer when your Strapi or Keycloak versions change.
- Plan a retest of SSO settings after Strapi or Keycloak upgrades, since release cadence on both projects is frequent.
- Ask for the support scope, response expectations and retest coverage in the quote so they match your change process.

