Hi. I'm experimenting with now.js, and sure like the idea.
However I've ran into trouble with session support using express.
This is my program's cflow:
clientside: user visits website
clientside: user clicks guest login
clientside: guest login click triggers now.guestLogin()
serverside: guestLogin creates a new guest user, and finishes login with finishLogin
serverside: finishLogin assigns the newly created guest user object to session.user
serverside: finishLogin triggers client's now.loginOk() method
clientside: loginOk is called and a request to a page requiring session.user is a user.
however the session.user set in finishLogin seems not to be persisted. So I went digging, logging the session variable when setting it and when requesting the page requiring to be logged in.
Server console:
$ node app.js
Express server listening on port 80 in development mode
now method session after user assignment =
{ lastAccess: 1341098607952,
cookie:
{ path: '/',
httpOnly: true,
_expires: Sun, 01 Jul 2012 03:23:27 GMT,
originalMaxAge: 14400000 },
user: { guest: true, nickname: 'guest0' } }
express session output =
{ lastAccess: 1341098609861,
cookie:
{ path: '/',
httpOnly: true,
_expires: Sun, 01 Jul 2012 03:23:27 GMT,
originalMaxAge: 14400000 } }
As you can see, the session does contain an actual user after assigning session.user (now method session output)
but it disappears again when I request a page after this (express session output).
Any ideas what's wrong here?
Kind regards
Ben