Skip to content

Commit

Permalink
fix: missing state does not throw (#1400)
Browse files Browse the repository at this point in the history
  • Loading branch information
colorfield authored Aug 22, 2023
1 parent 2604794 commit 89a3e9c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/npm/@amazeelabs/publisher/src/core/tools/oAuth2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,11 @@ export const persistState = (state: string, req: Request): void => {
export const stateMatches = (req: Request): boolean => {
const persistedState = req.session.state;
if (persistedState === undefined) {
throw new Error('Missing state.');
return false;
}
const encodedState = req.query.state as string;
if (encodedState === undefined) {
throw new Error('Missing state.');
return false;
}
const decodedState = Buffer.from(encodedState, 'base64').toString('ascii');
return persistedState === decodedState;
Expand Down

0 comments on commit 89a3e9c

Please sign in to comment.