According to documentation, I force a user to sign out with the method signOut()
.
This is what I have tried:
var rootRef = firebase.database().ref(); var loggedInUser = firebase.auth(); 1. firebase.signOut(); 2. loggedInUser.signOut(); 3. rootRef.signOut(); 4. signOut(); 5. firebase.auth.signOut();
I get ... is not a function
for every one of the five above. I know there is no issue with my reference to the new Firebase, since firebase.database().ref();
and firebase.auth();
does not throw error. I have also migrated the app in the console.
You can also delete users from the Authentication section of the Firebase console, on the Users page. Important: To delete a user, the user must have signed in recently. See Re-authenticate a user.
To detect if a user is already logged in Firebase with JavaScript, we can call the onAuthStateChanged method. firebase. auth(). onAuthStateChanged((user) => { if (user) { // ... } else { // ... } });
In JavaScript you can sign out the user with:
firebase.auth().signOut().then(function() { console.log('Signed Out'); }, function(error) { console.error('Sign Out Error', error); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With