diff --git a/src/config/initializers/middleware.js b/src/config/initializers/middleware.js index 3962d973..5c9cb60d 100644 --- a/src/config/initializers/middleware.js +++ b/src/config/initializers/middleware.js @@ -157,6 +157,12 @@ module.exports = (App, Config) => { */ Passport.use( new JwtStrategy(passportOpts, (payload, done) => { + const tokenWithoutExpiration = !payload.exp; + + if (tokenWithoutExpiration) { + return done(new Error('Invalid token, sign in again')); + } + /* Temporal compatibility with old JWT * BEGIN */