7

Sorry if its sound simple from the title. I google before asking but unable to understand https://www.google.co.in/?q=what+is+a+persistent+login+session.

I am following PassportJS docs where it is mentioned -

After successful authentication, Passport will establish a persistent login session.

What exactly does this persistent login session means and how it is different in terms of simple sessions in context of nodejs or passportJS.

mattias
  • 2,079
  • 3
  • 20
  • 27
Trialcoder
  • 5,816
  • 9
  • 44
  • 66
  • 1
    A short, computer scientific, definition for it is _a state that outlives the process creating it_. With that said, in some way you need to store the login information other than in the volatile memory, to make it persistent. – mattias Nov 11 '14 at 12:36
  • @mattias So in which file/folder do passport save the information ? – Trialcoder Nov 11 '14 at 12:46
  • One hint from http://passportjs.org/guide/configure/ is that this is stored in a cookie in the user's browser. – mattias Nov 11 '14 at 17:23
  • @mattias Please add it as an answer and I w'll surely accept it – Trialcoder Nov 12 '14 at 03:39

3 Answers3

5

According to http://passportjs.org/guide/configure/ the persistent session data is stored in a cookie in the user's browser.

mattias
  • 2,079
  • 3
  • 20
  • 27
3

Assuming that you already understand what a session is (they're tricky; if you're shaky on them, read this post):

tl:dr The difference is that a normal session ends when the user closes the browser, whereas a persistent login session ends at a specified (any) date in the future.

More: The difference is in the type of cookie used to create the session (i.e., to link the client-side identity information with server-side identity authentication information). Undated cookies expire when the user closes the browser; a persistent session cookie has an expiration date, which can be whenever the developer wishes.1

In the context of Node and Passport, this means that, with a "persistent login session", the user will be able to return to your site and not have to log in again.

Andrew
  • 3,825
  • 4
  • 30
  • 44
0

Persistent login session: allows users to stay logged in to a website or application even after they close the browser or leave the site. Users do not need to type login credentials (username and password) every time they revisit the site. When a user logs in and selects the option to "remember" or "stay signed in," a token or identifier is stored on their device, typically in the form of a cookie or local storage.This token serves as a proof of authentication and is sent back to the server for login validation.

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 08 '23 at 22:32