Request.session refreshes whenever a project is restarted

Hi, i’m making a login form with html & node.js (on the server side) It is working correctly, although when the project restarts (whenever i write code or an error drops) the session is not recognized by the project anymore. Is there any way to fix this?

You would need to keep track of them using cookies or localStorage. Try looking at the code for this package:

I’ve heard that there is cookie hacker wich lets create cookies or edit since they are on the local machine. How would i prevent that?

Are you using the express-session package?

Yes, i’m setting the session with it

Yeah, no wonder I’m facing this issue too. Maybe you should keep your project up 24/7?

I am, with uptimerobot, the problem is that sometimes it has a timeout and the project has to restart

But isn’t that how sessions are supposed to work? They should expire after some time???

Oh, i wanted it to last forever until the user has logged out

express-session won’t persist across server restarts, which is inevitable on glitch

1 Like

So do i use cookies instead?

I’ve found a solution. It was to use cookie-session instead. Thanks

1 Like