Repository navigation
[20.0][MIG] oauth_provider: Migration to 20.0 - #1049
Open
augusto-weiss wants to merge 34 commits into
Open
augusto-weiss wants to merge 34 commits into
augusto-weiss wants to merge 34 commits into
Conversation
OCA Transbot updated translations from Transifex OCA Transbot updated translations from Transifex OCA Transbot updated translations from Transifex OCA Transbot updated translations from Transifex OCA Transbot updated translations from Transifex OCA Transbot updated translations from Transifex [UPD] Update oauth_provider.pot
Lines removed tries to write on `client_id` attribute of the `oauth.provider.client` which do not have such an attribute. Theses sentences seams useless, so I removed it.
This module uses the method `get_frontend_session_info()` from `ir.http`, and this method is defined in the web module.
The bug is introduced by commit d46db56. The oauth.provider.client model is used to fill the `request.client` field in the _load_client() method of the OdooValidator class. The oauthlib python library need that the `client` object set in the `request` by the OdooValidator must contain an attribute named `client_id` which must contain the identifier of the oauth.provider.client. In other words the `client_id` attribute of the `client` object must contain the `client_id` that is posted by the HTTP request to the server. Source here: https://github.com/oauthlib/oauthlib/blob/dab6a5ae1830ddd8a79c1e9687f63508eae60b57/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py#L471-L474 The client_id was previously not part of the `oauth.provider.client` odoo model because it conflict in term of nomenclature with the odoo way of defining fields name. So it was added on the fly after for the record given to the oauthlib. Now, its not allowed to add such field like this, and doing that without explanation is quite confusing. So now the field with a name that breaks the Odoo nomenclature is added with a comment so that we can understand the exception done here.
…wrappers.BaseResponse
augusto-weiss
force-pushed
the
20.0-t-76767-awe
branch
from
October 21, 2026 20:12
5156ae4 to
a816f2b
Compare
Author
|
Tests are green (172, 0 failed / 0 errors). The red comes from checklog, on a core warning Since 7c69596e7997, |
augusto-weiss
force-pushed
the
20.0-t-76767-awe
branch
from
October 22, 2026 13:30
a816f2b to
8bc58cb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #1022 (19.0 migration, not merged yet): this branch carries its history.
Migration changes:
_auth_method_oauth_providertakes the newroutingargument ofir.httpin 20.0.ir.accesswith Odoo'supgrade_code.validate_userauthenticates like Odoo RPC (interactive: False):accepts an RPC API key instead of the password, requires it when the user has 2FA,
and no longer logs a web session in. It was broken since 17.0 (
Session.authenticatesignature)./oauth2/tokenno longer forces all client scopes on the token: it gets the requestedscopes, and with the authorization code grant the scopes granted to the code.
the computed
activefilter), and the new token gets the owner of the refreshed one(
validate_refresh_tokensets it). The controller no longer passes the user throughoauthlib extra credentials, so
odoo_user_idis not in the token response anymore./oauth2/tokeninfo:expires_inuses the whole lifetime (timedelta.secondsdropped the days)./oauth2/revoke_token:csrf=False(external clients can not send a CSRF token), no more500 on
auth="none"(odoo_user.activeread with sudo), and it also finds the refreshtoken of an expired access token.
readonly=Falseon the routes that write (auth="none"routes are readonly by default).readme/fragments;/oauth2/otherinfodocumented as deprecated.Tests:
WebRequest,wsgi_server): the controller base now usesHttpCase, with its own user (no demo data).allow_inherited_tests_method)./oauth2/resources/<model>, API key + 2FA, code scopes, refresh and revoke with an expiredaccess token,
expires_inover a day, revoke without CSRF, the state roundtrip with unsafecharacters.
CI note: tests pass; checklog fails on a core warning while compiling
web.assets_frontendwithout
html_editor(odoo/odoo#287582), see the comment below.Open questions:
for
scope = 'rpc'.ir.model.accesstoir.access; Odoo'supgrade converts them, not checked with OpenUpgrade.