开发者

difference between LoginToken and Session? node.js express connect

开发者 https://www.devze.com 2023-03-02 18:33 出处:网络
For example开发者_StackOverflow中文版 right here: http://dailyjs.com/2011/01/10/node-tutorial-9/

For example开发者_StackOverflow中文版 right here:

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

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? There's a session cookie and a session entry in the database. Can't you check against that instead of 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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号