Skip to content

Commit

Permalink
Merge pull request #10 from TiltingPoint/fix/logout-clear-cookies/PLA…
Browse files Browse the repository at this point in the history
…TFORM-3432

[PLATFORM-3432] Fix broken build due to logout endpoint
  • Loading branch information
Evanjt1 authored Jul 17, 2024
2 parents 1071ad9 + 949752e commit 0390691
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ const getCookies = (req: FastifyRequest): Record<string, string> => {
return parseCookies(cookies)
}

const setClearCookies = (reply: FastifyReply) => {
const clearedCookies = createTokenCookies('', '')
reply.header('Set-Cookie', clearedCookies)
}

const validateDPoP = (req: FastifyRequest): string => {
if (!USE_DPOP)
return ''
Expand Down Expand Up @@ -505,7 +510,7 @@ const logoutEndpoint = async (req: FastifyRequest, reply: FastifyReply) => {
const { nonce } = req.body as { nonce?: string }

await logoutUser(nonce || '')
setTokenCookies(reply, '', '')
setClearCookies(reply)

return reply.send({loggedOut: true})
}
Expand Down

0 comments on commit 0390691

Please sign in to comment.