Skip to content

Commit

Permalink
Do not set clientSecret for CODE-PKCE (RicoSuter#4184)
Browse files Browse the repository at this point in the history
  • Loading branch information
trejjam authored and lahma committed Jan 20, 2024
1 parent 30709d0 commit 2bd6202
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/NSwag.AspNet.Owin/SwaggerUi3/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,21 @@
});

if ("{ClientId}") {
ui.initOAuth({
const oAuthConfig = {
clientId: "{ClientId}",
clientSecret: "{ClientSecret}",
realm: "{Realm}",
appName: "{AppName}",
scopeSeparator: "{ScopeSeparator}",
scopes: {Scopes},
additionalQueryStringParams: {AdditionalQueryStringParameters},
usePkceWithAuthorizationCodeGrant: {UsePkceWithAuthorizationCodeGrant}
});
};

if (!{UsePkceWithAuthorizationCodeGrant}) {
oAuthConfig.clientSecret = "{ClientSecret}";
}

ui.initOAuth(oAuthConfig);
}

window.ui = ui;
Expand Down
11 changes: 8 additions & 3 deletions src/NSwag.AspNetCore/SwaggerUi3/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,21 @@
});

if ("{ClientId}") {
ui.initOAuth({
const oAuthConfig = {
clientId: "{ClientId}",
clientSecret: "{ClientSecret}",
realm: "{Realm}",
appName: "{AppName}",
scopeSeparator: "{ScopeSeparator}",
scopes: {Scopes},
additionalQueryStringParams: {AdditionalQueryStringParameters},
usePkceWithAuthorizationCodeGrant: {UsePkceWithAuthorizationCodeGrant}
});
};

if (!{UsePkceWithAuthorizationCodeGrant}) {
oAuthConfig.clientSecret = "{ClientSecret}";
}

ui.initOAuth(oAuthConfig);
}

window.ui = ui;
Expand Down

0 comments on commit 2bd6202

Please sign in to comment.