Odoo and Keycloak SSO integration

Single sign-on for self-hosted Odoo through Keycloak and the OCA auth_oidc module, covering client setup, token validation, user matching and the cases where SAML is the better fit.

On this page

How Odoo single sign-on with Keycloak works

A self-hosted Odoo instance with its own login screen can hand sign-in to a Keycloak realm that already holds the workforce identities. The supported route is the OCA auth_oidc module, which uses OpenID Connect and the authorization code flow. When a user opens Odoo, the module redirects the browser to the Keycloak login page. After the user authenticates, Keycloak sends the browser back to Odoo with an authorization code. Odoo's server then calls the realm's token endpoint, presenting that code together with the client secret, and receives an ID token and an access token. Odoo validates the token signatures against the public keys published at the realm's JWKS endpoint, then checks the issuer and audience before it trusts the identity. Because the code is exchanged on the server side, the client secret stays out of the browser.

Both the Community and Enterprise editions can run the module, since it is maintained in the Odoo Community Association set. Confirm the module's dependencies and supported Odoo versions in its own documentation before you plan the build, because an Enterprise-only dependency would change the edition decision. The module version must match the Odoo version in use: an Odoo 19.0 database needs the 19.0 branch of the OCA module, and the same discipline applies at every major upgrade. Treat the module branch as part of the upgrade plan, so that a version change on either side is tested together in a staging copy before production. Ask your Keycloak administrator to confirm the realm, client and redirect settings the module expects, because Odoo checks each login against those values.

What you need before configuring Keycloak and Odoo

Most SSO problems in this integration trace back to decisions made before anyone opens an admin console. The cards below cover the platform versions, hostnames, certificates, time sources and named owners that the Keycloak realm and the Odoo auth_oidc configuration both depend on. Confirm each item in writing with your team before the build starts.

Odoo edition and hosting model

Confirm whether you run Odoo Community or Enterprise and how it is hosted. Odoo's pricing page says only the Custom plan can be hosted on Odoo.sh or on-premise, so a self-hosted install with external API access and custom modules sits on that plan. A source install of Community is also possible. Record the exact Odoo major version now, because it decides which auth_oidc branch you use and when the next mandatory upgrade arrives.

Odoo pricing

Keycloak version and production database

The current Keycloak release is 26.8.1. Pin a version rather than tracking the latest build, and plan the upgrade cadence, since minor releases arrive several times a year. Production needs a supported external database, such as PostgreSQL 14 to 18. The dev-file database is for development only and should not hold your realm.

Keycloak database guide

Public HTTPS hostnames for both systems

Assign one stable HTTPS hostname to Keycloak and one to Odoo before creating any client. OpenID Connect redirect URIs and the issuer URL are tied to these names, so changing them later means editing the Keycloak client and the Odoo provider record together. Decide whether Keycloak sits behind a reverse proxy, and confirm that the proxy forwards the public hostname correctly to both services.

TLS certificate chain both systems trust

Keycloak must serve a certificate that Odoo's server trusts, and Odoo must present a certificate that the user's browser trusts. Confirm who issues the certificates, that the full intermediate chain is installed, and that the Odoo server can reach the Keycloak discovery URL over HTTPS. Private or internal certificate authorities need their root added to the Odoo host's trust store, or token and JWKS requests fail during login.

Clock-synchronized network

Token validation checks issue and expiry times, so Keycloak, the Odoo servers and any reverse proxy need synchronized clocks, usually through NTP. Clock drift is a common cause of tokens that appear invalid right after issue. Confirm which time source each host uses and that the hosts in a cluster agree before you test sign-in.

Named admin for each system

Name one accountable administrator for the Keycloak realm and one for the Odoo database before configuration begins. The Keycloak administrator controls clients, redirect URIs and user federation, while the Odoo administrator controls the identity provider record and the user creation rules. Keep a local Odoo admin login that works without Keycloak, so a broken identity provider does not lock out every user.

Configuring the Keycloak realm, client and Odoo provider

This sequence moves from a Keycloak realm and confidential client to a working Odoo sign-in through the auth_oidc module. Each step ends with a check so the team knows the layer beneath it works before the next one depends on it.

  1. Create or select the Keycloak realm

    Identity or platform engineers either select an existing realm for the organization's workforce users or create a dedicated realm for Odoo. Keep Odoo's users in the realm that already holds the directory or federation links your security team reviews, rather than creating a parallel user store. Confirm the realm is enabled, that the users who need Odoo access exist in it, and that the realm's sign-in settings, such as MFA requirements, match your policy. The step is done when a test user can sign in to the Keycloak account console for that realm.

  2. Create a confidential OpenID Connect client

    In the realm, create a client with OpenID Connect as the protocol and set client authentication to on so Keycloak issues a client secret. Enable the standard authorization code flow and leave other flows disabled unless you have a documented need for them. Set the client ID to a stable value your team will reference in Odoo configuration. The check is that the client appears in the realm's client list with client authentication enabled and the authorization code flow listed as active.

  3. Set the exact Odoo redirect URI

    Add the redirect URI that your Odoo instance will use for the OIDC callback, and set the web origins to the Odoo base URL. Use the exact scheme, host and path from your production Odoo, and confirm the path against the auth_oidc module documentation for your Odoo version rather than assuming it. Avoid wildcard redirect URIs in production. The check is a mismatch test later: a sign-in attempt from a host not on the list should be refused by Keycloak with a redirect error.

  4. Record the client secret in a secrets store

    Open the client's credentials tab and copy the client secret once. Store it in the secrets management system your organization uses, not in a shared document or in version control. Restrict access to the people who maintain the Odoo configuration. If the secret is later rotated in Keycloak, the Odoo side must be updated at the same time or sign-in will fail. The check is that the secret is retrievable from the secrets store by the Odoo administrator and not by general staff.

  5. Confirm the discovery document and JWKS endpoint

    Open the realm's OpenID configuration URL in a browser or with curl from the Odoo server network path, not only from a workstation. The response should be JSON that includes the issuer, authorization, token and userinfo endpoints, and a jwks_uri. Then open the jwks_uri and confirm it returns a set of public keys. The check is that both URLs respond over HTTPS from the Odoo host, and that the issuer value matches exactly what you will enter in Odoo.

  6. Install auth_oidc and register the identity provider

    Install the OCA auth_oidc module on the Odoo instance, using the version that matches your Odoo release and your change process for custom modules. Then, as an Odoo administrator, add an OpenID Connect identity provider with the issuer URL from the discovery document, the client ID, the client secret, and the scopes your deployment requires, typically including openid and the profile and email claims. Check the module's form labels against its current documentation. The check is that the provider saves without error and the module upgrade completes in a staging database first.

  7. Enable the login button and map users

    Enable the provider so that its sign-in button appears on the Odoo login page, and confirm which user matching behavior the module uses for the email or subject claim. Decide, before go-live, whether unmatched users are refused or created on first login, and document that decision with your identity team. Keep at least one local administrator account that does not depend on Keycloak, and test that it still works. The check is that the button appears on the login page and the local administrator can sign in.

  8. Test a non-admin sign-in end to end

    Sign in with a standard user account that has no Odoo administrator rights, starting from the Odoo login page and using the new button. Confirm the user is redirected to Keycloak, authenticates there, returns to Odoo, and lands on the expected user record with the intended access groups. Repeat with a user who has no account in Odoo to confirm the refusal or creation behavior you chose. Review the Odoo and Keycloak logs for the token exchange. The step is done when both test cases match the design written down in the previous step.

Token, userinfo and JWKS endpoints in the flow

The authorization endpoint is where the browser goes when a user clicks sign-in in Odoo. Odoo sends the user to Keycloak with the client identifier, the requested scopes, a state value and the redirect URI registered for the client. Keycloak authenticates the user, applies the realm's login flow (including any two-factor step), and redirects the browser back to Odoo with a short-lived authorization code. Nothing sensitive is returned here, so most failures at this stage are configuration mismatches rather than credential problems.

  • Client identifier: The client ID in the Odoo provider settings must match the client in the Keycloak realm exactly, including case.
  • Redirect URI: The redirect URI Odoo sends must match one registered in the Keycloak client, character for character, including scheme, host, port and path.
  • Scopes: The scopes Odoo requests must be permitted for the client, or claims Odoo expects may be missing.
  • State value: Odoo checks the returned state value, so a browser that blocks or drops the round trip will cause a rejected login.
  • Realm and host: The Keycloak base URL and realm name in Odoo must point to the same realm where the client was created.

Confirm the redirect URI and realm name against the Keycloak admin console before testing any user account.

Mapping Keycloak claims to Odoo users

This table compares each identity attribute in the Keycloak token with the Odoo field it should populate and the rule for matching or creating users. Read it as a checklist to confirm in your own realm before go-live, because the subject identifier is usually the safer match key than email. The main takeaway is that a login should attach to an account only through an attribute you have verified is stable and unique.

Claim or attributeOdoo field or useDecision and risk
Subject (sub)Stable external identifier stored with the Odoo userPreferred match key when the auth_oidc setup stores it. Confirm that the sub value is consistent for each person in your realm and does not change after a realm migration.
EmailOdoo login field (typically the login name)Convenient but risky as the sole match key. If an email is reused, reassigned or unverified, a new person can sign in to an existing Odoo account. Confirm email verification and uniqueness rules in Keycloak.
Preferred usernameOdoo login name, if you choose a username loginUsable only if your realm enforces unique usernames and users cannot rename themselves. Confirm this with your Keycloak administrators.
Given name and family nameOdoo user display nameLow risk for matching, but names are not unique. Use them for display only, and confirm how your directory formats them.
Group or role claimsOdoo access groups, if mapped by your configurationMapping roles to groups changes what users can do. Map only the roles your security team has approved, and confirm that removed roles also remove Odoo access on the next sign-in.
Create-on-first-login ruleAutomatic user creation for new peopleEnable only when every person allowed to sign in should receive an account. Otherwise a new Keycloak account can gain Odoo access without review. Confirm the default template user and its access rights.
Match existing user ruleLink the token to a pre-created Odoo userSafer for regulated teams because access is reviewed in advance. Pre-create users and confirm that the stored identifier matches the token claim exactly.
Local admin loginBreak-glass access if SSO failsKeep at least one local administrator who is not tied to Keycloak. Confirm where its credentials are stored and who can use them.

When SAML through auth_saml fits better than OpenID Connect

Choose SAML through the OCA auth_saml module when your enterprise identity estate or audit rules require SAML 2.0 assertions, or when a SAML trust with Odoo already exists in your federation. Keycloak supports both OpenID Connect and SAML 2.0 as client protocols, so Keycloak alone does not settle the question. The deciding factors are the Odoo module support you confirm for your version and the federation your organization already runs. Do not assume auth_saml is available or maintained for your Odoo release. Check the module's branch for your exact Odoo version in the OCA repositories, confirm that it installs cleanly on a staging copy, and confirm that its login flow works with the Keycloak realm you plan to use.

If you choose SAML, the Keycloak work moves from the OpenID Connect client to a SAML client: you define the entity ID, the assertion consumer service URL that Odoo exposes, the name ID format, and the attribute mappings for email, login and group membership. Certificates and signing settings become part of your operational checklist, including how and when the signing certificate is rotated and how Odoo receives the new metadata. Confirm these details against the auth_saml documentation for your version, because attribute names and endpoints differ between modules and should not be copied from an OIDC setup.

Keep the decision reversible in your plan. Whichever protocol you choose, the user matching rules, the local administrator account used for recovery, and the test cases for first login and deprovisioning stay the same. If SAML is required only for one business unit, confirm with your security team whether a second protocol will be supported in the same database, since running two sign-in paths adds review and testing work for each Odoo upgrade.

Hardening the Keycloak to Odoo trust path

Single sign-on moves the trust decision from Odoo's login form to Keycloak, so the client secret, redirect URIs, local fallback login and other sign-in methods all become part of one trust path. The cards below cover the settings to lock down on each side and the operational checks that keep them locked down after go-live.

Confidential client with a rotated secret

Register Odoo in the Keycloak realm as a confidential client so the client secret is checked at the token endpoint. Keep the secret out of odoo.conf where your deployment allows it, for example in a secrets store or an environment variable injected at process start, and record who can read it. Plan a rotation date and test it in a staging copy before production. Confirm with the auth_oidc module documentation how the secret is supplied in your Odoo version.

Keycloak admin docs

Exact redirect URIs only

List each redirect URI for the Odoo database as a full, exact address, including scheme, host, port and path. Avoid wildcards such as ` because a broad pattern lets an attacker redirect an authorization code to a page they control. Remove test and old hostnames from the client when a database is retired. Also set the web origins for the client so only your Odoo host can make cross-origin calls.

PKCE only where both sides support it

Proof Key for Code Exchange adds a per-request verifier to the authorization code flow and helps protect against code interception. Enable it in Keycloak only if the auth_oidc version you deploy sends the code challenge and verifies it. Test a sign-in on a staging copy after changing this setting, because a mismatch fails every login. If the module does not support PKCE, record that as an accepted gap and keep the other controls in place.

Local admin login kept for break-glass

Keep one local Odoo administrator account that does not depend on Keycloak, so an identity outage or a misconfigured client does not lock every administrator out. Store its password in a sealed, audited location and give it two-factor authentication, which Odoo supports for user sign-in. Test the break-glass path on a schedule, and confirm that the account is disabled for daily work and that its use triggers an alert to the security team.

Odoo LDAP docs

Overlapping sign-in methods

Odoo can also sign in users through LDAP, Google Sign-In, Microsoft Azure OAuth and Facebook sign-in, and each enabled method is another path into the same database. List every enabled method, the users who can use it, and whether it bypasses Keycloak group or disabled-user checks. Disable methods you do not need, and confirm that a user disabled in Keycloak cannot still sign in through another path.

Odoo LDAP docs

Keycloak production settings and metrics

Keycloak's production guidance covers hostname, TLS, proxy headers and the admin console, and the metrics endpoint shows login errors and token activity. Review the production configuration before go-live and route metrics to your monitoring stack, then set alerts for spikes in failed logins and token errors. Keep the Keycloak version under a planned upgrade cadence, because the project publishes minor releases several times a year.

Current Keycloak release
26.8.1
Keycloak production guide

How a user signs in from Odoo through Keycloak

The sign-in starts when the browser requests the Odoo login page and is redirected to the Keycloak authorization endpoint, which is reached over the public path. After the user authenticates, Keycloak returns an authorization code to the Odoo callback, and the auth_oidc module, running inside the internal network, exchanges that code at the token endpoint. Before Odoo creates its session, it checks the ID token signature against keys from the JWKS endpoint, then matches the user, so check the trust boundary and the token validation at each hand-off.

Sign-in flow from the browser through Keycloak and back to an Odoo session, with the trust boundary marked.

Common failures in Odoo Keycloak sign-in

This table lists the sign-in failures most often seen when Odoo uses Keycloak through the OCA auth_oidc module, with the likely cause, how to confirm it in logs and the fix. Work down the rows in order when a login fails, because the first mismatch usually blocks everything after it.

FailureLikely causeHow to confirm in logsFix
Redirect URI mismatchThe redirect URI registered on the Keycloak client does not exactly match the callback URL Odoo sends, including scheme, host, port or path.Keycloak event or error page reports an invalid redirect URI. Compare the redirect_uri parameter in the browser address bar with the client's valid redirect URIs.Register the exact callback URL Odoo uses, with the same scheme and port, and remove stale entries for old hostnames.
Wrong issuer or discovery URLThe issuer or well-known discovery URL in Odoo points to the wrong realm, a different hostname, or a Keycloak base path that does not match the server's configured path.Odoo server log shows failures fetching the discovery document or validating the token issuer. Open the discovery URL in a browser and compare the issuer value with the one configured.Set the issuer to the exact realm URL shown in Keycloak's discovery document, including any path prefix, then restart Odoo.
Invalid client secretThe secret stored in Odoo was rotated in Keycloak, copied with extra whitespace, or the client is configured as public and no secret is expected.Token exchange at the Keycloak token endpoint is rejected with a client authentication failure in the Keycloak log. Check the client's credentials tab for the active secret.Copy the current secret from the Keycloak client, paste it without spaces, and confirm the client authentication setting matches what auth_oidc expects.
Untrusted certificateOdoo's server does not trust the certificate chain of the Keycloak HTTPS endpoint, often because an internal certificate authority is not installed in the system trust store.Odoo log shows a certificate verification error when calling the discovery, token or JWKS endpoints. Test the endpoints from the Odoo host with a command-line HTTPS client.Install the internal root and intermediate certificates into the Odoo host's trust store, and make sure the Python environment uses it. Do not disable verification.
Clock skew causing token rejectionThe Odoo host and the Keycloak host have clocks that differ enough that issued-at or expiry checks on the ID token fail.Odoo log shows the token was rejected for timing reasons while the same user succeeds after a retry. Compare the time on both hosts with a time synchronization status command.Run NTP or chrony on every host in the flow and confirm they stay in sync before changing any Odoo or Keycloak setting.
User matching failure creating duplicate accountsauth_oidc matches the returned identity to an existing Odoo user by a field such as login or email, and the identity provider sends a different value than the stored one, so a new user is created.Odoo Users list shows two accounts for one person, one with the Keycloak identifier. Compare the claim Odoo uses for matching with the claim in a decoded test token.Choose one stable matching claim, correct existing records to use it, and disable automatic user creation for users outside the approved group until matching is verified.
Missing scopes or claimsThe client does not request the openid scope or the scopes that carry the email or name claims, or a Keycloak client scope mapper does not add the claim to the token.Decoded ID token or userinfo response lacks the expected claim. Check the scopes requested in the authorization URL and the mappers on the Keycloak client scope.Add the required scopes to the Odoo provider configuration, add or fix the protocol mapper in Keycloak, and test with a new sign-in because old sessions keep old claims.

Questions buyers ask about Keycloak SSO for Odoo

Can our own team set up Keycloak SSO for Odoo without a partner?

Yes, a team with Keycloak administration skills and Odoo administration access can do this internally, and the OCA auth_oidc module is the piece that connects Odoo to the identity provider. The work splits into three parts: configuring a client in the Keycloak realm, configuring the auth_oidc provider in Odoo, and deciding how users are matched and what happens to local accounts. Teams without recent experience in OpenID Connect usually spend most of their time on redirect URIs, token validation and user matching rather than on the Odoo screens. An external partner is most useful when the realm design, the upgrade plan and the test evidence need to be reviewed by people who have done it before. Ask any partner to show how they would test sign-in, fallback admin login and account offboarding before accepting the scope.

What makes the effort for Keycloak SSO for Odoo grow or shrink?

The main drivers are the number of Keycloak realms and clients involved, the user matching rules, the choice between OpenID Connect and SAML, certificate and key handling, and how the work is coordinated with Odoo upgrades. A single realm with one Odoo database and a clear match on email is far simpler than several realms feeding several Odoo companies or databases. SAML through the OCA auth_saml module adds metadata exchange and signing certificate work that OIDC avoids in most setups. Each additional identity owner who must approve claims, groups or offboarding rules adds review time. Ask for a quote that lists realms, Odoo databases, matching rules, protocol choice and the test environments included, because these items set the effort more than the Odoo screens do.

How do Odoo version upgrades affect the Keycloak SSO setup?

An Odoo upgrade can change the auth_oidc module version, its compatibility with the target Odoo release and the settings that users see, so the SSO configuration must be retested after every upgrade. On Odoo Online and Odoo.sh, major version upgrades are mandatory every two years according to the Odoo upgrade documentation, so an SSO design should assume a repeating test cycle. Odoo standard support covers the first three years after a major release, and security patches are only provided during standard support, so the target version and its support end date should be set before the module is chosen. Odoo's upgrade service moves a database through an upgraded test database that should be tested before production, and the SSO login should be part of that test. Confirm the module version for each target Odoo release with the module maintainers before the upgrade is scheduled.

Can the Community edition of Odoo use the auth_oidc module?

The OCA auth_oidc module is an open source add-on and is developed by the Odoo Community Association, so it is designed to work with Odoo Community installs, but you must confirm the module version and its dependencies for the exact Odoo release you run. Odoo's own documentation shows that the Community edition has no access to the upgrade service, so Community deployments must plan upgrades without that tool. The Enterprise edition is licensed separately and its source is not public, so mixing Enterprise-only features with a Community install needs a licensing review. Odoo's pricing page places external API access and custom modules in the Custom plan, which matters if SSO is delivered through custom code instead of the OCA module. Check the current license terms and the Odoo edition you run before committing to the design.

What do we need to provide for a Keycloak SSO project?

The project needs administrator access to the Keycloak realm, administrator access to the Odoo database and server, and a test copy of Odoo where the login flow can be tried without touching production users. Odoo documents database duplication with neutralization for test copies, which is the usual way to get a safe environment for SSO testing. Identity owners must confirm which users, groups and roles are allowed in, how accounts are matched to existing Odoo users and how leavers are removed. Your security team should also confirm where client secrets and the local Odoo admin fallback are stored. Ask the partner to list these inputs in the written scope so that any gap is found before work starts.

Does Keycloak SSO for Odoo need a retainer after go-live?

A retainer is not required, but most organizations need someone to own the SSO configuration after go-live because Keycloak and Odoo both change on their own release schedules. Keycloak has moved to four minor releases a year since version 26.0, with breaking changes in minor releases made opt-in, and Odoo SaaS versions are released every two to three months. Ongoing work usually includes reviewing Keycloak upgrades, retesting sign-in after each Odoo upgrade, rotating client secrets and checking that offboarding still removes access. DeployOpen offers ongoing support, upgrades and continuous testing as retainers, and the scope and frequency are agreed in writing. Internal ownership is also workable if the team has the skills and the test environment to repeat the checks.

How DeployOpen scopes and delivers Keycloak SSO for Odoo

DeployOpen treats Odoo and Keycloak SSO integration as a written, fixed-scope piece of work inside your own infrastructure. We agree the realm design, client settings, user matching and test plan before configuration begins, then hand over documentation your team can run.

How we scope

  • Confirm the Odoo edition, version and hosting type, since the auth_oidc approach depends on your deployment
  • Map which Keycloak realm, clients, groups and user attributes Odoo will rely on
  • Agree in writing how users are matched, whether first login creates accounts, and how a local admin login is kept

How we build

  • Configure the Keycloak client with authorization code flow, redirect URIs and the token and JWKS endpoints Odoo uses
  • Install and configure the OCA auth_oidc module in a staging Odoo database before any production change
  • Test sign-in, sign-out, failed logins, disabled accounts and role mapping against the agreed test cases

How we hand over

  • Deliver a written record of realm, client and Odoo settings, with secrets stored outside the code repository
  • Document the user matching rules, fallback login procedure and steps for rotating the client secret
  • Walk your administrators through the configuration and the checks they should repeat after each upgrade

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer after handover
  • Plan Keycloak and Odoo version changes with a staging test before production, since both projects release on their own schedules
  • Quote any support scope from the written statement of work so ongoing costs are visible before work starts

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.