From 1c41c86af29324773ac09955d70b02b35abce34f Mon Sep 17 00:00:00 2001 From: Bram Esposito Date: Thu, 29 Feb 2024 10:53:39 +0100 Subject: [PATCH] Add a specific Action Wrapper for OAuth Authorization requests #1190 So that the schema reloads after authorization --- drf_spectacular/templates/drf_spectacular/swagger_ui.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drf_spectacular/templates/drf_spectacular/swagger_ui.js b/drf_spectacular/templates/drf_spectacular/swagger_ui.js index efee7ef3..0c9b954e 100644 --- a/drf_spectacular/templates/drf_spectacular/swagger_ui.js +++ b/drf_spectacular/templates/drf_spectacular/swagger_ui.js @@ -10,6 +10,11 @@ const reloadSchemaOnAuthChange = () => { statePlugins: { auth: { wrapActions: { + authorizeOauth2:(ori) => (...args) => { + schemaAuthFailed = false; + setTimeout(() => ui.specActions.download()); + return ori(...args); + }, authorize: (ori) => (...args) => { schemaAuthFailed = false; setTimeout(() => ui.specActions.download());