mweibel / connect-session-sequelize

Sequelize SessionStore for Express/Connect

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem using passport with connect-session-sequelize

radcapitalist opened this issue · comments

This is a similar issue to the one reported here, except this time I don't seem to have the control I need.

Passport middleware is internally (as far as I can tell) setting the authenticated user in the session, saving the session, and then redirecting. Unlike in the case of flash messages, where I was the one setting the flash message and thus could call req.session.save() myself and only continue after it completed, in this case a third party is saving the session and redirecting, and the session is not done saving by the time the redirect loads the session back out of the database.

Any suggestions for how to handle this?

Actually, this is not out of my control: I can call req.session.save() in the callback for passport.authenticate() before I redirect. So the same workaround works. I'll close this.