I am working on a project and I’ve created a login page. I want to authenticate the user and keep the user logged in until he logs out. How do I do that using React, Express and MongoDB?
I am working on a project and I’ve created a login page. I want to authenticate the user and keep the user logged in until he logs out. How do I do that using React, Express and MongoDB?
2
Answers
You can use browser’s localstorage and save the userInfo there and when he logs out you can clear the storage. You can check this set localstorage
Or you can make it from the server side with session-express and redis express sesson
Proper basic implementation here is the followings: