Sign in to your other apps with Odoo.
Odoo becomes the OpenID Connect provider for the tools your team already uses. An app finds the endpoints on its own, sends its users to Odoo to sign in, and gets back a signed id_token that says who they are.
An app reads the endpoints, scopes and signing keys from the discovery document Odoo publishes.
Each id_token is RS256-signed, carries the app's nonce and checks out against Odoo's public keys.
Name, email, address, phone: a client may ask only for the scopes you tick for it.
OpenID Connect on your OAuth2 clients
MuK REST API already signs users in over OAuth2. This module adds the identity on top: a client that asks for the openid scope gets an id_token beside its access token, and the user it names is an Odoo user.
/.well-known/openid-configuration lists the endpoints, grants and claims; /.well-known/jwks.json holds the public signing keys.
RS256, with issuer, subject, audience, issue and expiry time, the nonce the app sent and the claims of every scope granted. How long one stays valid is a setting.
profile, email, address and phone, filled from the user and their contact. The UserInfo endpoint answers with the claims a token's scopes allow, nothing more.
Every OAuth2 client gets an OIDC Scopes tab. A request for a scope the client was not given is refused; a request without one gets all it was given.
The first request that needs a signing key creates one. Rotate Key retires it and generates the next, in one click.
The authorization code is stored with the app's PKCE challenge, S256 or plain, and a wrong code_verifier gets nothing back. A stolen code is worthless without the verifier.
What an app sees
Most OIDC libraries need only your server's address and a client's key and secret; the rest they read for themselves. $ODOO is that address and $CODE the code Odoo hands back to the callback after the user signs in, $VERIFIER the PKCE secret the app made before sending them there, and $TOKEN the access token from the second call.
# 01 Discover: where to sign in, which scopes, how tokens are signed $ curl $ODOO/.well-known/openid-configuration {"issuer": "https://odoo.example.com", "authorization_endpoint": "https://odoo.example.com/api/v2/authentication/oauth2/authorize", "scopes_supported": ["openid", "profile", "email", "address", "phone"], "id_token_signing_alg_values_supported": ["RS256"], ...} # 02 Sign in: trade the code from the callback for tokens $ curl -X POST -u $CLIENT_ID:$CLIENT_SECRET -d 'grant_type=authorization_code' -d "code=$CODE" -d 'redirect_uri=https://app.example.com/callback' -d "code_verifier=$VERIFIER" $ODOO/api/v2/authentication/oauth2/token {"access_token": "g2G7vjLBpflD...", "token_type": "Bearer", "expires_in": 3600, "scope": "openid profile email", "id_token": "eyJhbGciOiJSUzI1NiIs..."} # 03 Ask: who signed in, as far as the granted scopes allow $ curl $ODOO/api/v2/authentication/oauth2/userinfo --oauth2-bearer $TOKEN {"sub": "2", "name": "Mitchell Admin", "preferred_username": "admin", "locale": "en_US", "zoneinfo": "Europe/Brussels", "email": "admin@example.com", ...}
One key, published and replaceable
Odoo signs id_tokens with a 2048-bit RSA key it creates for itself. Its Key ID travels in every token's header and its public half in the JWKS, so an app finds the right key without being told.
The private key is stored encrypted with the database secret and readable only by administrators. Rotate Key archives it and creates the next; tokens signed with the old one stop validating, so rotate when you need to, not on a schedule.
One setting, then a client per app
The only setting is how long an id_token stays valid, an hour unless you change it. Then give each app an OAuth2 client with its callback, tick the scopes it may ask for, and hand its key and secret to the app.
A refresh token keeps the OIDC scopes it was issued with, as far as the client still has them, and every refresh brings a new id_token.
Odoo as the provider
The module answers one question for other apps: who is this Odoo user. What sits around that answer comes from MuK REST API or from Odoo itself.
Clients, grant types, callbacks, the sign-in page and token revocation are MuK REST API's. This module adds the scopes, the keys and the id_token.
For the other direction, Odoo users signing in with an outside provider, Odoo's own OAuth Authentication setting is the place.
Every subject is a user who can sign in to Odoo, and every claim comes from that user and their contact. Archive the user and the next sign-in fails.
Help and support
What is covered after you buy, and where to write.
30 days of complimentary support for issues with the module, from the date of purchase. Data recovery, migration and training are not covered.
support@mukit.at for a technical issue — with your Odoo version and the request you sent. sale@mukit.at for anything before you buy.
MuK Proprietary Licence v1.0 — one database per licence. You may build modules on top of it; you may not redistribute it.
Want more?
MuK IT — Austrian Odoo partner, ViennaModules written for your process, on your Odoo version.
Odoo joined up with the systems you already run.
Hosting, deployment and upgrades you do not have to watch.
Your team taught the parts of Odoo they actually use.
An agreement, so an answer does not depend on who is free.
Documentation
The full text is on the Documentation tab, and in doc/ inside the download.Odoo.sh or on-premise, Community or Enterprise, with MuK REST API and its OAuth2 support, which needs the oauthlib Python package.
Settings › General Settings › API sets the id_token lifetime. Each OAuth2 client lists the scopes it may ask for on its OIDC Scopes tab.
Depends on muk_rest. The signing key is created by the first request that needs one.
Give the app your Odoo's address as the issuer and the client's key and secret. It reads everything else from /.well-known/openid-configuration.
Signing keys and client scopes are records, and an upgrade keeps them. Issued id_tokens stay valid until they expire.
MuK IT GmbH, Vienna. Author and maintainer.
Have apps that should sign in with Odoo?
Tell us which ones, and we will tell you whether a client and its scopes are enough or the sign-in needs more. MuK IT — Austrian Odoo partner, Vienna.
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Community Apps Dependencies | Show |
| Lines of code | 11905 |
| Technical Name |
muk_oidc |
| License | See License tab |
| Website | http://www.mukit.at |
MuK OpenID Connect
Extends the MuK REST API to turn Odoo into a fully compliant OpenID Connect (OIDC) Identity Provider. Adds discovery, JWKS, id_token issuance, and standard OIDC scopes on top of the existing OAuth2 authorization server.
Installation
To install this module, you need to:
Download the module and add it to your Odoo addons folder. Afterward, log on to your Odoo server and go to the Apps menu. Trigger the debug mode and update the list by clicking on the "Update Apps List" link. Now install the module by clicking on the install button.
Upgrade
To upgrade this module, you need to:
Download the module and add it to your Odoo addons folder. Restart the server and log on to your Odoo server. Select the Apps menu and upgrade the module by clicking on the upgrade button.
Configuration
- ID Token Lifetime -- Settings > General Settings > API, block OpenID Connect: how long an issued id_token stays valid, in seconds (default 3600).
- OIDC Scopes -- Settings > API > Configuration > OAuth2, tab OIDC Scopes on each client: the scopes the client may request (openid, profile, email, address, phone).
- Signing Keys -- Settings > API > Tokens > OIDC Keys (developer mode): the RSA key is generated on first use and its private key stored encrypted with the database secret. Rotate Key archives the current key and generates a new one.
Usage
The provider publishes:
- /.well-known/openid-configuration -- discovery document
- /.well-known/jwks.json -- public signing keys
- /api/v2/authentication/oauth2/authorize -- authorization endpoint
- /api/v2/authentication/oauth2/token -- token endpoint
- /api/v2/authentication/oauth2/userinfo -- UserInfo endpoint
A client that requests the openid scope receives an RS256-signed id_token with iss, sub, aud, iat, exp, the nonce it sent and the claims of its granted scopes:
- profile -- name, preferred username, locale, timezone, last update
- email -- email address
- address -- postal address
- phone -- phone number
The UserInfo endpoint returns the same claims, limited to the scopes the access token was granted. The authorization code flow supports PKCE (S256 or plain): the challenge is stored with the code and a wrong code_verifier is refused. A request for a scope the client was not given is refused, and a refresh token keeps the OIDC scopes it was issued with. The OIDC scopes are also listed in the OAuth2 flows of the REST API documentation.
Credits
Contributors
- Mathias Markl <mathias.markl@mukit.at>
Author & Maintainer
This module is maintained by the MuK IT GmbH.
MuK IT is an Austrian company specialized in customizing and extending Odoo. We develop custom solutions for your individual needs to help you focus on your strength and expertise to grow your business.
If you want to get in touch please contact us via mail (sale@mukit.at) or visit our website (https://mukit.at).
MuK Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from MuK IT GmbH. The above permissions are granted for a single database per purchased license. Furthermore, with a valid license it is permitted to use the software on other databases as long as the usage is limited to a testing or development environment. You may develop modules based on the Software or that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the MuK Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module