Expressjs cookie-session maxAge don't work

84 views
Skip to first unread message

Max

unread,
Sep 2, 2016, 11:57:50 AM9/2/16
to Express
Hello, sory for my bad english


I can't understand, why is config maxAge set to 1 is not working...
app.use(cookieSession({
 
name: 'sessiondata',
 
keys: ['key1', 'key2'],
 
cookie: {
           
maxAge: 1 //not work
         
}
   
})
);



Althrought, direct input is work fine
app.get('/login', function(req, res, next) {
res
.cookie(
'id', 'lol'); //not work
res
.cookie(
'id2', '2222222', { maxAge: 1222});//work
res
.send(req.cookies.id+req.cookies.id2);
 
//res.render('login');
});



Max

unread,
Sep 6, 2016, 8:05:50 AM9/6/16
to Express
Just use req.session instead req.cookie

пятница, 2 сентября 2016 г., 18:57:50 UTC+3 пользователь Max написал:
Reply all
Reply to author
Forward
0 new messages