I have tried to re-authenticate a user with firebase but I can't seem to get it to work. I have looked at the firebase documentation but it wasn't helping me. Here is what I got.
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 {
}
}
}
I am trying to re-authenticate to change the user password.
You need to provide the actual credential:
let credential = EmailAuthProvider.credential(withEmail: email, password: password)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With