【问题标题】:Unauth Firebase user using new Firebase SDKUnauth Firebase 用户使用新的 Firebase SDK
【发布时间】:2016-06-05 01:42:14
【问题描述】:

在旧的 Firebase 中,我们可以使用以下命令简单地取消身份验证/注销用户:

reference.unauth()

我没有看到任何地方,即使在他们的文档中,如何在新的 Firebase 中做到这一点。也许我错过了。

【问题讨论】:

    标签: swift firebase firebase-authentication


    【解决方案1】:
    try! FIRAuth.auth()!.signOut()
    

    参考文档:底部here

    编者注: 尝试!当您知道可以抛出的函数将成功时编写。所以它是声明的一部分。不过感谢您的编辑。

    【讨论】:

    • 试试吧! FIRAuth.auth()!.signOut() 不会完全注销用户。上一个方法运行后,我运行print(FIRAuth.auth()!.currentUser.uid),还是打印出用户id。你能提供更多信息吗?
    【解决方案2】:

    这就是我执行注销的方式,它似乎对我有用。希望这会有所帮助。

        do {
            try FIRAuth.auth()?.signOut()
        } catch let logoutError {
            print(logoutError)
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-21
      • 2019-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-02
      相关资源
      最近更新 更多