Why is there a cookie in the req.session in node express?

Viewed 3828

It's more for my understanding. Why is there a cookie object in the req.session in express? I use req.session to store the login status and username. The cookie object in req.session is the same as the cookie properties in the client cookie, placed by express.parseCookie but without sessionID. Can anyone explain why this is in there? It cant be for the purpose to identify cookie and session because thats already made by the cookie value and the session ID (req.session.ID), or am I'm wrong?

- req.session --> 
{ cookie: 
{ path: '/',
 _expires: null,
 originalMaxAge: null,
 httpOnly: true },
  loggedIn: true,
  username: 'luidpold' }
1 Answers
Related