-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Using express-session passport is trying to associate value in the session by key instead of using req.session.save(cb). If there is latency on saving the session, the cb is called right after may happen before it is persisted and deserialized.
Any session store/delete should be used with express-session callback.
It mainly happens in this part of the code: https://github.com/jaredhanson/passport/blob/master/lib/sessionmanager.js#L25
Expected behavior
cb function should be called after the session is stored in store (db, redix, etc..)
Actual behavior
Sometimes, if there is latency between the application and the store (db), the redirect happens before the data is persisted in the db.
Steps to reproduce
I tried using multiple stores and dbs, and was able to get the same issue.
it can be reproduced by using express-session + external store (preferably a database)
Environment
- Operating System: Ubuntu | Mac OS | Docker Container
- Node version: v8.11.2
- passport version: 0.4.0