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

feat: save pkce code verifier/challenge for debugging #1455

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 6 additions & 1 deletion client/src/js/modules/oidcProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,13 @@ function getTokenRequestBody(code, redirectUri) {
params.append('grant_type', 'authorization_code')
params.append('client_id', state.clientId)
params.append('redirect_uri', redirectUri)
params.append('code_verifier', localStorage.getItem('oidc-code-verifier'))
const codeVerifier = localStorage.getItem('oidc-code-verifier')
params.append('code_verifier', codeVerifier)

// Clear saved code verifier to prevent replay error scenarios
localStorage.removeItem('oidc-code-verifier')
// Save last used verifier for debugging purposes
localStorage.setItem('last-code-verifier', codeVerifier)

return params
}
Expand Down Expand Up @@ -238,6 +241,8 @@ async function getAuthorizationUrl() {

// Save the code verifier for use after the OP redirect back to us
localStorage.setItem('oidc-code-verifier', pkce.codeVerifier)
// Save the code challenge for debugging purposes
localStorage.setItem('last-code-challenge', pkce.codeChallenge)

return `${authEndpoint}?${params.toString()}`
}
Expand Down
Loading