express-jwt
express-jwt copied to clipboard
token expired callback
I created a callback in the case of an expired token, with the token decoding itself
router.use(
jwt({secret: 'ssshhhh', isExpired: (err, req, next) => {
// check conditions
if (req.user.uid == null) {
return next(err);
}
// TODO: ...
return next();
}}),
(req, res, next) => {
// TODO: ...
});
Can this be merged? @jfromaniello
@jfromaniello ?
This functionality would be useful to me.
Wow, this is exactly what I needed when I wrote #209; I think I'll just checkout & deploy this to my own npm package instead 8)
For posterity, and anyone else using this implementation: while writing tests for this, I found that invalid issuer errors can be swallowed under certain circumstances. This will hopefully be resolved in https://github.com/priore/express-jwt/pull/1 .
I am so embarrassed... but I am here after FOUR YEARS 🥹
Do you still think this is useful?
I added this feature in [email protected]
https://github.com/auth0/express-jwt#handling-expired-tokens