注销Firebase身份验证

维蒙德

使用react-native制作一个简单的firebase auth应用。注册/登录工作正常,但是我无法退出以正常工作。

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();

退出按钮很简单,因为:

<Button style={styles.button}
            full
            rounded
            onPress={() => this.signOutUser()}
>
保罗

您的注销用户的函数被调用,signOutUser但是deleteAccount当您按下按钮时,您调用的函数名为
尝试:

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

另外,您可能需要将signOutUser函数更改为:

firebase.auth().signOut().then(function() {
  // Sign-out successful.
}).catch(function(error) {
  // An error happened.
});

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章