I am developing an application in React – Express – Mongo, how can i keep the user logged even after the browser is closed or page is refreshed?
I am developing an application in React – Express – Mongo, how can i keep the user logged even after the browser is closed or page is refreshed?
5
Answers
Assuming you have something like this:
you could do something like this:
A simple example for your understanding ,how to usage of localStorage,
sessionStorage.
https://www.geeksforgeeks.org/difference-between-local-storage-session-storage-and-cookies/
in as a response
cookies)
page if it exists redirect the page to the login
Store JWT Token in LocalStorage or Cookies. That’s the Simplest way.
check out here – https://www.freecodecamp.org/news/how-to-persist-a-logged-in-user-in-react/