Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0] base_rest: Define the oauth2 redirect url into swagger ui #379

Merged
merged 1 commit into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
7 changes: 7 additions & 0 deletions base_rest/readme/newsfragments/379.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Add support for oauth2 security scheme in the Swagger UI. If your openapi
specification contains a security scheme of type oauth2, the Swagger UI will
display a login button in the top right corner. In order to finalize the
login process, a redirect URL must be provided when initializing the Swagger
UI. The Swagger UI is now initialized with a `oauth2RedirectUrl` option that
references a oauth2-redirect.html file provided by the swagger-ui lib and served
by the current addon.
3 changes: 3 additions & 0 deletions base_rest/static/src/js/swagger_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ odoo.define("base_rest.swagger_ui", function (require) {
$(".topbar").prepend(this.web_btn);
}
},
oauth2RedirectUrl:
window.location.origin +
"/base_rest/static/lib/swagger-ui-3.51.1/oauth2-redirect.html",
};
const config = this.$el.data("settings");
return Object.assign({}, defaults, config);
Expand Down