Cookie issues in nodejs

Viewed 19

I have the following code using node js on heroku

app.use(cookieParser());

const expiresIn = 60 * 60 * 24 * 5 * 1000;
const options = {maxAge: expiresIn, httpOnly: false, secure: false};
res.cookie('session', 1, options);

I'm setting a cookie when someone logs in, but that cookie disappears after a short while on heroku using nodejs.

Unfortunately, after 5 minutes, the cookie "session" expires and req.cookies.session returns empty.

Can someone please help?

0 Answers
Related