This commit is contained in:
Lukian LEIZOUR 2024-06-06 13:53:44 +02:00
parent cd74f8e71b
commit d4d7f51d03
6 changed files with 58 additions and 7 deletions

View file

@ -13,7 +13,11 @@ router.post('/', async (req, res) => {
}
try {
jwt.verify(token, process.env.JWTSecret);
const user = jwt.verify(token, process.env.JWTSecret);
if (user.expiration < Date.now()) {
return res.status(400).send({error: "token expired"});
}
} catch {
return res.status(400).send({error: "invalid token"});
}