Answer the question
In order to leave comments, you need to log in
How to use persistent Firebase authorization?
I read about Firebase Auth that it’s not possible to call signInWithEmailAndPassword every time, but you can save the previous session and not create new ones every time. Moreover, this behavior (LOCAL) seems to be the default. But now I'm meditating on the documentation and just can't figure out how to do something.
Where does execution begin?
firebase.initializeApp (Config);
This is a synchronous function, it does not go to the network.
And the next call to Firebase has already started authorization:
await firebase.auth ().signInWithEmailAndPassword
(User_Mail, User_Password);
firebase.auth ().currentUser
await firebase.auth ().currentUser.reload ();
await firebase.auth ().updateCurrentUser (null);
FirebaseError
A null user object was provided as the argument for an operation which requires a non-null user object.
updateCurrentUser ( user : User | null ) : Promise < void >
setPersistence ( persistence : Persistence ) : Promise <void>
await firebase.auth ().setPersistence
(firebase.auth.Auth.Persistence.LOCAL);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question