How to do login control when the front end uses react framework development

the front end of a recent development project is built using react.
encountered a problem is that I don"t know how to log in with the background Synchronize.

my logic is like this. After the user logs in successfully, I use localstorage to store the relevant information of the user, and then store the login status of the user as true,

but there is a problem. When the server is forced to restart, the login status of the server is gone, but the login status of the user is still stored in the localstorage of the client as true.

I would like to ask you how to deal with the Synchronize login status of the front and back end when using the react framework for development

Mar.23,2021

when logging in, both the server side and the client side assign the same login session,. No matter any operation, the client side and the server side session are required to do an equal check. If the session is equal, the operation is allowed. It is not equal to clear the Airbus client login and require re-login


.

login status is usually saved in cookie. Save it in cookie, and you can pass it back and forth when you request a backend interface. It is stored in localstorage and cannot be passed to the backend

.

in addition, this has nothing to do with react.


has not been verified, but I personally understand that if you use session, if the login information slows down, then the restart must be gone, if you put it in the database.
if you use token, the login status should not disappear as long as the time does not expire.

Menu