我了解您可以在启动应用时设置maxAge,如下所示:
connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }})
但是,我想按照“记住我”的设置实施一些东西,我该怎样做呢?
非常感谢:)
杰森
答案 0 :(得分:40)
您可以在属于当前用户的个人Cookie上设置expires
或maxAge
:
// This user should log in again after restarting the browser
req.session.cookie.expires = false;
// This user won't have to log in for a year
req.session.cookie.maxAge = 365 * 24 * 60 * 60 * 1000;