Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I sign out users in Firebase 3.0?

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.

like image 864
hellogoodnight Avatar asked May 22 '16 16:05

hellogoodnight


People also ask

How do I remove a user from Firebase?

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.

How do I detect if a user is already logged in Firebase?

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 { // ... } });


1 Answers

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); }); 
like image 119
Frank van Puffelen Avatar answered Oct 08 '22 03:10

Frank van Puffelen