且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

登录passwordjs后如何设置会话超时时间?

更新时间:2023-02-26 17:52:06

通过Connect的会话中间件处理,例如:

.use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}))

文档还有其他有用的地方,对于理解会话处理值得一读. /p>

I want to set a session timeout after log in using passportjs. How to set the maxAge for the session using passportjs. What is the default max age for the session that passportjs provide?

That is handled via Connect's session middleware, so for example:

.use(connect.session({ secret: 'keyboard cat', cookie: { maxAge: 60000 }}))

The documentation has other useful bits that are worth reading for understanding session handling.