Reputation: 41605
I am using a computer in the place as work as a web dedicate server for the application. (so sessions won't be shared)
I want to develop a secure remember me functionality and i was wondering which is the best way to do it:
With cookies I would have to encrypt the user password, create some salts and add some fields in the database. (as detailed here or here)
Wouldn't it be more simple using sessions in this case configuring them to last longer?
Thanks.
Upvotes: 0
Views: 771
Reputation: 8426
Cookies vs. Sessions
PROS for Sessions:
CONS
Sessions hold memory on the server side. Also session cookies expire when the browser closes. Though this could be re-configured (if you try really hard). You basically end up re-creating the cookie in a slightly new avatar.
All in all Cookies VS Sessions for "remember me" its cookies without a doubt.
Upvotes: 0
Reputation: 1046
Cookies.
You need to store some state on the client. The idea of "remember me" is that coming back to the same site without a session will still get you logged back in, without having a valid session established.
Cookies allow you to store state. There can be other ways to do it, but definitely not sessions.
Upvotes: 1