auth_oauth_end_session: single sign-on logout
A small companion addon, independent of the connector. Odoo's OAuth login only ends the Odoo session on logout; the session at the identity provider stays, and the next sign-in logs straight back in. With an end-session URL on the provider, logging out of Odoo ends that session too.
When a user logs out, Odoo's OAuth login (auth_oauth) ends only the Odoo session. The session at the identity provider remains, so the next Sign in with … logs the same user straight back in without asking. This is the default for every Odoo behind Keycloak, and on a shared terminal it is a problem.
| Module | auth_oauth_end_session |
| Depends on | auth_oauth only, with no dependency on the connector |
| Installs | By hand |
| Affects | Users who signed in through a provider with an end-session URL. Password logins are untouched |
| Source | openepcis-odoo · LGPL-3 |
The addon ships in the connector's repository because an Odoo that talks to OpenEPCIS usually has users who sign in through the same Keycloak. Nothing in it depends on OpenEPCIS, though, and it is useful on its own.
Setting it up
- Install
auth_oauth_end_session. - On the OAuth provider in Odoo (Settings → Users & Companies → OAuth Providers), fill in End session URL. For Keycloak this is the realm's OpenID Connect logout endpoint:
https://<host>/realms/<realm>/protocol/openid-connect/logout - On the client in Keycloak, register the Odoo login page as a valid post-logout redirect URI:
https://<odoo>/web/login
From then on, logging out of Odoo sends a user who signed in through that provider on to the end-session endpoint (OpenID Connect RP-initiated logout), and the provider returns them to Odoo's login page.
One thing to expect
Odoo's OAuth login uses the implicit flow and receives no ID token, so the logout request carries no id_token_hint. Without that hint, the provider may ask the user to confirm the logout before ending the session. This is the provider handling a request it cannot fully attribute with due care, and the setup is working as intended.