Skip to content

Commit

Permalink
fix(auth): add 401 status code when JWT is expired
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedevita authored and ghaiklor committed Dec 14, 2016
1 parent 836757c commit db9c562
Showing 1 changed file with 1 addition and 0 deletions.
Expand Up @@ -9,6 +9,7 @@ const passport = require('passport');

module.exports = (req, res, next) => {
passport.authenticate('jwt', (error, user, info) => {
if (info.name === 'TokenExpiredError') info.status = 401;
if (error || !user) return res.negotiate(error || info);

req.user = user;
Expand Down

0 comments on commit db9c562

Please sign in to comment.