我曾尝试使用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 {
}
}
}
我正在尝试重新验证以更改用户密码。
答案 0 :(得分:3)
您需要提供实际凭证:
let credential = EmailAuthProvider.credential(withEmail: email, password: password)