Skip to content

Commit

Permalink
todo: handle expired JWTs
Browse files Browse the repository at this point in the history
  • Loading branch information
saifali96 committed May 7, 2022
1 parent 5a3b73a commit 59370e8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/utilities/PasswordUtility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ export const ValidateSignature = async (req: Request) => {

if (signature) {

const payload = await jwt.verify(signature, JWT_SECRET) as AuthPayload;

// TODO : Handle expired JWT tokens
req.user = payload;
return true
try {
const payload = jwt.verify(signature, JWT_SECRET) as AuthPayload;
req.user = payload;
return true
} catch(err) {
console.error(err);
return false;
}
}

return false;
Expand Down

0 comments on commit 59370e8

Please sign in to comment.