From f18db2a887e0d2cdab810ccc2dc15c0537716b89 Mon Sep 17 00:00:00 2001 From: Rico Suter Date: Wed, 17 Jan 2024 09:28:40 +0100 Subject: [PATCH] Allow client secret when usePkceWithAuthorizationCodeGrant is true, revert #4184 --- src/NSwag.AspNetCore/SwaggerUi/index.html | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/NSwag.AspNetCore/SwaggerUi/index.html b/src/NSwag.AspNetCore/SwaggerUi/index.html index ff2ba2322..1e23b0e15 100644 --- a/src/NSwag.AspNetCore/SwaggerUi/index.html +++ b/src/NSwag.AspNetCore/SwaggerUi/index.html @@ -65,21 +65,17 @@ }); if ("{ClientId}") { - const oAuthConfig = { + var clientSecret = "{ClientSecret}"; + ui.initOAuth({ clientId: "{ClientId}", + clientSecret: clientSecret ? clientSecret : undefined, realm: "{Realm}", appName: "{AppName}", scopeSeparator: "{ScopeSeparator}", scopes: {Scopes}, additionalQueryStringParams: {AdditionalQueryStringParameters}, usePkceWithAuthorizationCodeGrant: {UsePkceWithAuthorizationCodeGrant} - }; - - if (!{UsePkceWithAuthorizationCodeGrant}) { - oAuthConfig.clientSecret = "{ClientSecret}"; - } - - ui.initOAuth(oAuthConfig); + }); } window.ui = ui;