Skip to content

Commit bcde184

Browse files
authored
Merge pull request #551 from patrickbowie/master
Added generated nonce parameter.
2 parents 1bf2935 + f9c9d60 commit bcde184

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/templates/security-scheme-template.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ async function onInvokeOAuthFlow(securitySchemeId, flowType, authUrl, tokenUrl,
162162
const checkedScopeEls = [...authFlowDivEl.querySelectorAll('.scope-checkbox:checked')];
163163
const pkceCheckboxEl = authFlowDivEl.querySelector(`#${securitySchemeId}-pkce`);
164164
const state = (`${Math.random().toString(36)}random`).slice(2, 9);
165+
const nonce = (`${Math.random().toString(36)}random`).slice(2, 9);
165166
// const codeChallenge = await generateCodeChallenge(codeVerifier);
166167
const redirectUrlObj = new URL(`${window.location.origin}${window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/'))}/${this.oauthReceiver}`);
167168
let grantType = '';
@@ -189,6 +190,7 @@ async function onInvokeOAuthFlow(securitySchemeId, flowType, authUrl, tokenUrl,
189190
authCodeParams.set('redirect_uri', redirectUrlObj.toString());
190191
authCodeParams.set('response_type', responseType);
191192
authCodeParams.set('state', state);
193+
authCodeParams.set('nonce', nonce);
192194
if (pkceCheckboxEl && pkceCheckboxEl.checked) {
193195
authCodeParams.set('code_challenge', codeChallenge);
194196
authCodeParams.set('code_challenge_method', 'S256');

0 commit comments

Comments
 (0)