Skip to content

Commit

Permalink
fix: gracefully handle invalid logout challenges (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
hperl authored Dec 12, 2023
1 parent 9ad2556 commit caa7c9e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/routes/logout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ export const createSubmitLogoutRoute: RouteCreator =
return oauth2
.rejectOAuth2LogoutRequest({ logoutChallenge })
.then(() => res.redirect("welcome"))
.catch(next)
.catch(() => res.redirect("welcome"))
} else {
logger.debug("User agreed to log out.")
// The user agreed to log out, let's accept the logout request.
return oauth2
.acceptOAuth2LogoutRequest({ logoutChallenge })
.then(({ data: body }) => res.redirect(body.redirect_to))
.catch(next)
.catch(() => res.redirect("welcome"))
}
}

Expand Down

0 comments on commit caa7c9e

Please sign in to comment.