Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sign out firebase auth

Making a simple firebase auth app with react-native. Register/sign in works just fine, but I can't get the sign out to work properly.

loginUser = (email,password) => {
    try{
      firebase.auth().signInWithEmailAndPassword(email, password).then(function(user){
        console.log(user)
      })
    }
    catch(error){
      console.log(error.toString())

    }
  }

  signOutUser = () => firebase.auth.signOut();

The sign out button is easy as this:

<Button style={styles.button}
            full
            rounded
            onPress={() => this.signOutUser()}
>
like image 457
vemund Avatar asked Sep 14 '25 16:09

vemund


2 Answers

Your function to sign users out is called signOutUser but you call a function named deleteAccount when your button is pressed.
Try:

onPress={() => this.signOutUser()}

Also you may need to change the signOutUser function to:

firebase.auth().signOut().then(function() {
  // Sign-out successful.
}).catch(function(error) {
  // An error happened.
});
like image 183
paulgio Avatar answered Sep 17 '25 07:09

paulgio


Your function is named signOutUser in your code, but your HTML is trying to call a function named deleteAccount.

If you have a different deleteAccount we'll need you to show us that too.

like image 32
JeremyW Avatar answered Sep 17 '25 08:09

JeremyW