I use express to support my session management:
app.use(express.cookieParser('your secret here'));
app.use(express.session({secret: 'mysecretcode'}));
I what to extract and save the sessionId from the request. However, the id I get from req.sessionID is different to that sent in the cookie:
req.sessionID --> 'E7oSoKmQfcMKnk5_jA5tF5vR'
cookie.connect.sid --> 's%3AE7oSoKmQfcMKnk5_jA5tF5vR.DQnYdDDcFn8K2JJHMgWL5DTzNYYwIU3DA5a10WImA7U';
- Why these two are different?
- How can I get connect.sid before sending a response?