如何在客户端获取'connect.sid'的cookie过期?(How can I get the cookie expiration for 'connect.sid' on client-side?)

我的Web应用程序使用的是AngularJS,NodeJS,Express和Passport。 当我执行CTRL + Shift + I并查看Google Chrome上“资源”选项卡下的Cookie时,我会看到“connect.sid”,我希望从中获取到期日期。 可能吗? 我尝试在客户端使用document.cookie但没有显示任何内容。

这是我用来设置'connect.sid'的截止日期的代码

app.use(express.session({cookie : { maxAge: 3600000 * 24 * 30 * 2 }));

My web application is using AngularJS, NodeJS, Express, and Passport. When I do a CTRL+Shift+I and look at the Cookies under the Resources tab on Google Chrome, I see 'connect.sid' that I would like get the expiration date from. Is it possible? I have tried using document.cookie on the client-side but nothing shows up.

This is the code I used to set up the expiration date for 'connect.sid'

app.use(express.session({cookie : { maxAge: 3600000 * 24 * 30 * 2 }));

最满意答案

不,您无法从客户端获取cookie的到期日期。 document.cookie只会给你key = value对。

No you can not get the expiration date of the cookie from client side. document.cookie will only give you key=value pairs.

如何在客户端获取'connect.sid'的cookie过期?(How can I get the cookie expiration for 'connect.sid' on client-side?)

我的Web应用程序使用的是AngularJS,NodeJS,Express和Passport。 当我执行CTRL + Shift + I并查看Google Chrome上“资源”选项卡下的Cookie时,我会看到“connect.sid”,我希望从中获取到期日期。 可能吗? 我尝试在客户端使用document.cookie但没有显示任何内容。

这是我用来设置'connect.sid'的截止日期的代码

app.use(express.session({cookie : { maxAge: 3600000 * 24 * 30 * 2 }));

My web application is using AngularJS, NodeJS, Express, and Passport. When I do a CTRL+Shift+I and look at the Cookies under the Resources tab on Google Chrome, I see 'connect.sid' that I would like get the expiration date from. Is it possible? I have tried using document.cookie on the client-side but nothing shows up.

This is the code I used to set up the expiration date for 'connect.sid'

app.use(express.session({cookie : { maxAge: 3600000 * 24 * 30 * 2 }));

最满意答案

不,您无法从客户端获取cookie的到期日期。 document.cookie只会给你key = value对。

No you can not get the expiration date of the cookie from client side. document.cookie will only give you key=value pairs.