【问题标题】:Error When SignOut Users - invertase React Native Firebase注销用户时出错 - invertase React Native Firebase
【发布时间】:2020-02-17 03:43:51
【问题描述】:

我正在尝试从“我的应用”中注销用户,但我从控制台收到此消息。

Possible Unhandled Promise Rejection (id: 1):
TypeError: undefined is not an object (evaluating '_auth.firebase.auth.currentUser.signOut')

按照文档 (https://invertase.io/oss/react-native-firebase/v6/auth/reference/module#signOut) 我做了一个这样的函数

async function LogoutUser() {
    firebase.auth.currentUser.signOut();
  }

但用户帐户没有任何反应。请问,谁能帮帮我?

【问题讨论】:

    标签: firebase react-native react-native-firebase


    【解决方案1】:

    signOut 是 auth 的函数。试试下面的代码

     firebase.auth().signOut().then(function(){
            console.log('Signed Out');
        },function(error){
    
        });
    

    【讨论】:

      【解决方案2】:
      async function LogoutUser() {
          **await** firebase.auth.currentUser.signOut();
      }
      

      别忘了使用 await

      https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await

      【讨论】:

        猜你喜欢
        • 2019-01-16
        • 2022-01-22
        • 1970-01-01
        • 2018-06-15
        • 1970-01-01
        • 2018-11-24
        • 2020-07-21
        • 2016-09-15
        相关资源
        最近更新 更多