Some Questions about User Login in WEB System

  node.js, question

Everyone knows that users can use cookies to keep their login status when logging in, but I don’t know much about cookies yet. I hope you can help me.

I want to know if the following conditions will occur:
I have been browsing and other activities on the page, will the cookie be invalid during this period, or the login status will not drop. (In other words, the next request for a resource that requires the user to log in cannot be accessed.)
Do users have to be able to stay logged in when cookie exist?

Thank you for your answers first.

  1. cookieYou can set the expiration time. If you don’t set the expiration time, the browser cookie will be cleared by default, so it is unlikely that you will lose the login status during the visit, unless the expiration time of this cookie is very short, but the normal development process will definitely not do this.

  2. Whether the cookie has always been effective depends on the specific login logic. For example, some websites restrict multi-point login. You may log in at one place, and after logging in at another place, the original cookie will become invalid. There are many situations and specific analysis is required.