In my React project, I have implemented authentication using Firebase authentication. Upon signing in successfully, the user details get stored in a 'user' object in the localStorage, and remain stored until the user specifically logs out. It is the presence of this 'user' object which is used to check whether the person is authenticated or not, and then subsequently open protected routes.
However, this method leads to a problem that one might copy the user details from the localStorage, and then set them manually using the console. This would lead to that user being signed in without authentication using their password.
So what is the correct and secure method to implement persistence of authentication in React