fix: save and send cookie in dev setup

This commit is contained in:
eneller
2026-03-08 20:39:04 +01:00
parent c9a2cd8d66
commit 80529225c7
6 changed files with 24 additions and 12 deletions

View File

@@ -17,11 +17,10 @@ router.post('/login', async (req, res) => {
// successfully authenticated
res.cookie('jwt', 'toekn', {
/*
httpOnly: true, // Prevent XSS
secure: true, // HTTPS only
sameSite: 'strict', // CSRF protection
*/
secure: false, // HTTPS only
sameSite: 'lax', // CSRF protection
domain: '.localhost',
maxAge: 86400000, // 1 day
});
res.json({ message: 'Logged in successfully' });
@@ -37,7 +36,6 @@ router.post('/logout', (req, res) => {
});
router.get('/status', (req, res) => {
console.log(req.cookies);
if (isAuthenticated(req)){
return res.status(200).json({authenticated: true});
}