Thursday, 1 June 2017

Why is req.session.token being undefined?

I have this simple login like so:Parse.User.logIn(req.body.brand, req.body.password).then(function(user) { req.session.user = user; req.session.token = user.getSessionToken(); res.redirect('/'); }, function(error) { console.log(error) req.session = null; res.render('login'); }); For some reason req.session.token is being undefined.here's part of my app.js.app.use(cookieSession({ name: "session", secret: "SECRET_SIGNING_KEY", maxAge: 15724800000 })); app.use(cookieParser()); app.use(expressSession({secret:'somesecrettokenhere',resave: false, saveUninitialized: true, cookie: {secure: true }})); I feel something in my app.js is preventing it from working?

Submitted June 01, 2017 at 07:07PM by farhansyed7911

No comments:

Post a Comment