Hello, I have been working with express.js and have encountered an issue with express-sessions. Here is how my express session is configured in index.js:
app.use(
session({
secret: 'idegas',
resave: false,
saveUninitialized: false,
cookie: {
maxAge: null,
user_identification: null,
authorized: false,
}
}))
When a user is on the login page and successfully logs in, I want to assign them a session. I achieve this in login.js:
req.session.cookie.expires = new Date(Date.now() + '7200000')
req.session.cookie.user_identification = id
req.session.cookie.authorized = true
After the user is redirected to the dashboard, I check the user's session in the console and see the following output:
Session {
cookie: {
path: '/',
_expires: null,
originalMaxAge: null,
httpOnly: true,
user_identification: null,
authorized: false
}
}
It appears that nothing has changed. I'm puzzled as to why this is not working. Any suggestions? Thank you!