I want to store user authentication information in a browser cookie for permanent login. As they say, never store sensitive information (such as a password) in a cookie, but in order to have an option like "Remember password", I think there is no other choice.
So, if the user wants to remember his registration information, and if I store the username (email address) + not a password, but other unique information, such as a HASHED DB ID in a cookie. Then I have to check if the hashed identifier stored in the cookie matches the email of the user stored in the Cookie. As I think, everyone can very easily see cookies stored in the browser (for example, in Firefox, Options β Cookies).
So, it would be as weak as for someone to read a cookie from a computer, where it is stored, and then set a cookie with this information on another computer, and it will be logged in? (Since the script will check the stored email and hashed id with the database, and it will match)?
Is it possible to improve this approach without storing other information in the database (for example, session identifier, etc.)? Thanks
source share