【问题标题】:How to re-authenticate a user with firebase如何使用firebase重新验证用户
【发布时间】:2018-04-29 18:55:09
【问题描述】:

我尝试使用 firebase 重新验证用户身份,但似乎无法正常工作。我查看了 firebase 文档,但对我没有帮助。这是我得到的。

var emailTextField: UITextField!
var currentPasswordTextfield: UITextField!

let reEnterInfo = UIAlertController(title: "Re-Enter Email and Password", message: nil, preferredStyle: .alert)
        reEnterInfo.addTextField(configurationHandler: emailTextField)
        reEnterInfo.addTextField(configurationHandler: currentPasswordTextfield)
        let reSignInButton = UIAlertAction(title: "Re-Sign In", style: .default, handler: self.reSignIn)
        reEnterInfo.addAction(reSignInButton)
        self.present(reEnterInfo, animated: true, completion: nil)

  func reSignIn(alert: UIAlertAction!)
  {
    let user = Auth.auth().currentUser
    let credential: AuthCredential

    user?.reauthenticate(with: credential) { error in
        if error != nil {

        } else {

        }
   }
}

我正在尝试重新验证以更改用户密码。

【问题讨论】:

    标签: swift firebase firebase-authentication


    【解决方案1】:

    您需要提供实际的凭证:

    let credential = EmailAuthProvider.credential(withEmail: email, password: password)
    

    【讨论】:

    • 我如何获取电子邮件和密码以便用户可以再次进行身份验证?
    猜你喜欢
    • 2020-10-13
    • 2017-02-24
    • 2017-04-15
    • 2018-03-28
    • 2019-02-14
    • 1970-01-01
    • 2021-06-16
    • 1970-01-01
    • 2019-03-15
    相关资源
    最近更新 更多