From c6683c36f51180de3b184a04e1776b1ec02a406b Mon Sep 17 00:00:00 2001 From: Sergio Gutierrez Villalba Date: Wed, 12 Jun 2024 15:01:55 +0200 Subject: [PATCH] fix(auth): reject with 401 non-expiration-set tokens --- src/config/initializers/middleware.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/initializers/middleware.js b/src/config/initializers/middleware.js index 5c9cb60d..8389d130 100644 --- a/src/config/initializers/middleware.js +++ b/src/config/initializers/middleware.js @@ -160,7 +160,7 @@ module.exports = (App, Config) => { const tokenWithoutExpiration = !payload.exp; if (tokenWithoutExpiration) { - return done(new Error('Invalid token, sign in again')); + return done(null, false, { message: 'Invalid token, sign in again' }); } /* Temporal compatibility with old JWT