hellogoodnight hellogoodnight - 6 months ago 190
Javascript Question

How do I sign out users in Firebase 3.0?

According to documentation, I know force a user to sign out with the method

signOut()


this is what I have tried, (one at the time though :P ):

var rootRef = firebase.database().ref();
var loggedInUser = firebase.auth();

firebase.signOut();
loggedInUser.signOut();
rootRef.signOut();
signOut();
firebase.auth.signOut();


I get ... is not a function for each and every one of them. 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.

Answer

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);
});
Comments