Decoupled JWT from DB
This commit is contained in:
1 parent
14f6f05dfc
commit
0cc7751d2e
5 files changed
+16
-7
No files matched your search
@@ -38,7 +38,7 @@ const verifyJWT = (req, res, next) => {
|
||||
if (err) {
|
||||
try {
|
||||
const userId = jwt.decode(parsedToken)._id;
|
||||
await User.updateOne({ _id: userId }, { $unset: { authToken: null } });
|
||||
await req.db.logoutUser(userId);
|
||||
logger.error(errorMessages.INVALID_AUTH_TOKEN, {
|
||||
service: SERVICE_NAME,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user