在android中,我使用reauthenticate但是在swift中,我可以使用哪种方式?例如,在像这样的机器人
Firebase.getCurrentUser().reauthenticate(EmailAuthProvider.
getCredential(Firebase.getCurrentUser().getEmail(),old_pass))
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
//add some code
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
//add some code
}
});
}});
答案 0 :(得分:1)
根据Firebase文档,这应该有效:
let user = FIRAuth.auth()?.currentUser
var credential: FIRAuthCredential
let user = FIRAuth.auth()?.currentUser
var credential: FIRAuthCredential
// Prompt the user to re-provide their sign-in credentials
user?.reauthenticate(with: credential) { error in
if let error = error {
// An error happened.
} else {
// User re-authenticated.
}
}
这是我的来源:https://firebase.google.com/docs/auth/ios/manage-users#re-authenticate_a_user