express-jwt icon indicating copy to clipboard operation
express-jwt copied to clipboard

token expired callback

Open priore opened this issue 6 years ago • 5 comments

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: ...
});

priore avatar May 25 '18 22:05 priore

Can this be merged? @jfromaniello

@jfromaniello ?

FieryCod avatar Jul 15 '18 14:07 FieryCod

This functionality would be useful to me.

justin-scx avatar Jul 18 '18 21:07 justin-scx

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)

Spencatro avatar Oct 16 '18 02:10 Spencatro

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 .

Spencatro avatar Oct 16 '18 05:10 Spencatro

I am so embarrassed... but I am here after FOUR YEARS 🥹

Do you still think this is useful?

jfromaniello avatar Dec 22 '22 13:12 jfromaniello

I added this feature in [email protected]

https://github.com/auth0/express-jwt#handling-expired-tokens

jfromaniello avatar Dec 22 '22 13:12 jfromaniello