I set a session cookie as part of PassportJS. I see that the cookie connect.sid is passed to the browser and back to the application on subsequent HTTP requests.
However, when I read req.cookies on one of my routes, it is empty. I set express.cookieParser (), express.session () and passport.session () in the configuration settings. Is there anything else that needs to be done to use cookies in Express / Node?
Here are the settings for my application:
app.configure(function () { app.set("db_url", config.db[app.settings.env]); app.set('port', process.env.PORT || 3000); app.use(express.logger('dev')); app.use(express.static(path.join(__dirname, 'public'))); app.use(express.cookieParser()); app.use(express.bodyParser()); app.use(express.session({secret: "keyboard cat"})); app.use(passport.initialize()); app.use(passport.session()); app.use(users); app.use(orgs); app.use(errorHandler); });
Thanks!
source share