Skip to content

token expired callback - #195

Closed
priore wants to merge 1 commit into
auth0:masterfrom
priore:master
Closed

token expired callback#195
priore wants to merge 1 commit into
auth0:masterfrom
priore:master

Conversation

@priore

@priore priore commented May 25, 2018

Copy link
Copy Markdown

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

@george-norris-salesforce

Copy link
Copy Markdown

Can this be merged? @jfromaniello

@kwojcik-blockether

Copy link
Copy Markdown

@jfromaniello ?

@justin-scx

Copy link
Copy Markdown

This functionality would be useful to me.

@Spencatro

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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 .

@jfromaniello

Copy link
Copy Markdown
Contributor

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

Do you still think this is useful?

@jfromaniello

Copy link
Copy Markdown
Contributor

I added this feature in express-jwt@8.2.0

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants