简体   繁体   English

LoginToken 和 Session 之间的区别? node.js 快速连接

[英]difference between LoginToken and Session? node.js express connect

For example right here:例如在这里:

http://dailyjs.com/2011/01/10/node-tutorial-9/ http://dailyjs.com/2011/01/10/node-tutorial-9/

https://github.com/alexyoung/nodepad/blob/master/models.js https://github.com/alexyoung/nodepad/blob/master/models.js

There's something called a login token.有一种东西叫做登录令牌。 I don't understand what the point of that is, isn't there already a session?我不明白这是什么意思,不是已经有 session 了吗? There's a session cookie and a session entry in the database.数据库中有一个 session cookie 和一个 session 条目。 Can't you check against that instead of LoginToken?你不能检查一下而不是 LoginToken 吗?

Thanks.谢谢。

This isn't really a node.js question, since it applies just as much to websites written in any language, but here's an answer.这并不是一个真正的 node.js 问题,因为它同样适用于以任何语言编写的网站,但这里有一个答案。

Session cookies are generally quite short-lived, and reference a whole bunch of information about what you're currently doing on a website, which you don't want to store for every user for weeks or months. Session cookies 通常寿命很短,并且参考了有关您当前在网站上所做的大量信息,您不想为每个用户存储数周或数月。 The login token is a much longer-lived cookie that just records that this web browser is authorised to connect as this user without having to go through the login process.登录令牌是一个寿命更长的 cookie,它仅记录此 web 浏览器被授权以该用户身份连接,而无需通过登录过程访问 go。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM