I’m making a Flutter application where the user has to register and log in with email and password.
Is there a way to ask the registered user to enter his password every time he wants to log in ?
The output would be like this :
Welcome back [email protected]
please type your password to enter the app
I’ve searched the subject in the FirebaseAuth documentation, but couldn’t find any relative information.
2
Answers
Realistically and practically speaking, you would use some type of local storage to signal to your app that the user is signed in, or out. If you use page load events only to signout the user, they will be signed out when opening a new tab which would probably be annoying.
You could use an unload event to prompt the user "You will be signed out of this application when you leave this page"
Doing all of that, the onload event could look for that auth state variable in local storage.
You can explicitly sign any current user out when loading the page. See the bottom of the documentation page on email+password authentication for an example.