This commit is contained in:
seb
2026-07-31 07:07:31 +02:00
parent 043305c04c
commit 52355aba4a
2 changed files with 16 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
import jwt from 'jsonwebtoken';
import env from '../../../config/env.js';
import { clearCachedUser } from '../../middleware/auth.js';
import { clearCachedUser, clearTokenCookie } from '../../middleware/auth.js';
/**
* Registers the logout route (clears session cookie).
@@ -26,11 +26,7 @@ export function register(app, basePath = '') {
}
}
res.clearCookie('token', {
httpOnly: true,
secure: true,
sameSite: 'strict',
});
clearTokenCookie(res);
res.status(200).json({ message: 'Logged out successfully' });
});
}