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,031
  • 3
  • 21
  • 27
Trialcoder
  • 5,392
  • 9
  • 40
  • 65
  • 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

2 Answers2

5

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

mattias
  • 2,031
  • 3
  • 21
  • 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
  • 2,310
  • 2
  • 24
  • 31