Skip to content

Commit

Permalink
fix(oauth): correctly remove code_verifier cookie when used (#2325)
Browse files Browse the repository at this point in the history
Co-authored-by: Pol Bonastre <pbonastre@plainconcepts.com>
  • Loading branch information
pbr1111 and pbr1111 authored Jul 8, 2021
1 parent ac5b4db commit f546e55
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/server/lib/oauth/pkce-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ export async function handleCallback (req, res) {
pkceLength: PKCE_LENGTH,
method: PKCE_CODE_CHALLENGE_METHOD
})
cookie.set(res, cookies.pkceCodeVerifier.name, null, { maxAge: 0 }) // remove PKCE after it has been used
// remove PKCE after it has been used
cookie.set(res, cookies.pkceCodeVerifier.name, "", {
...cookies.pkceCodeVerifier.options,
maxAge: 0
})
} catch (error) {
logger.error('CALLBACK_OAUTH_ERROR', error)
return res.redirect(`${baseUrl}${basePath}/error?error=OAuthCallback`)
Expand Down

1 comment on commit f546e55

@vercel
Copy link

@vercel vercel bot commented on f546e55 Jul 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.