Here's what I'm seeing:
cookie["connect.sid"] = "s:95wlB0OWL+9baRJ1R4v3JMGK.ZVE6TBraqEFyl54qURXZsro1VULjyLs7xRVQNKedFck"
sessionStore.sessions["95wlB0OWL+9baRJ1R4v3JMGK"] = {"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"_id":"51107c6634378ae60a000001"}
It looks like what we're saving ("_id") in req.session at login is getting saved in sessionStore. That's good. But I see only one session in sessionStore and its key/id is "95wlB0OWL+9baRJ1R4v3JMGK", not "s:95wlB0OWL+9baRJ1R4v3JMGK.ZVE6TBraqEFyl54qURXZsro1VULjyLs7xRVQNKedFck", i.e. not connect.sid.
But in the socket.io handshake code we're basically doing this:
sessionStore.get("s:95wlB0OWL+9baRJ1R4v3JMGK.ZVE6TBraqEFyl54qURXZsro1VULjyLs7xRVQNKedFck", function (err, session) { ... });
and what gets returned is an undefined session. I'm guessing because there is no session associated with "s:95wlB0OWL+9baRJ1R4v3JMGK.ZVE6TBraqEFyl54qURXZsro1VULjyLs7xRVQNKedFck" in sessionStore.
Were we expecting express to store our session in sessionStore (MemoryStore) because we did this:
app.use(express.session({
secret: 'my_secret',
store: nocklib.getSessionStore()
}));
It appears it did do that but it didn't use connect.sid as the session key/id. How do we retrieve our session from sessionStore if we don't know the key/id with which to retrieve it?
I'm not sure how to proceed from here. Please advise.
Bookmarks