登录passwordjs后如何设置会话超时时间? [英] How to set the session timeout after log in passportjs?

查看:80
本文介绍了登录passwordjs后如何设置会话超时时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在使用passportjs登录后设置会话超时.如何使用password.js设置会话的maxAge.护照js提供的会话的默认最大年龄是多少?

解决方案

通过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.

这篇关于登录passwordjs后如何设置会话超时时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆