I've been looking in the Firebase Documentation and found the method to reauthenticate a user shown below.
let user = Auth.auth().currentUser
var credential: AuthCredential
// 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.
}
}
I get an error and a warning though from the compiler as follows:
Error:
Variable 'credential' used before being initialized
Warning:
'reauthenticate(with:completion:)' is deprecated: Please use reauthenticateAndRetrieveDataWithCredential:completion: for Objective-C or reauthenticateAndRetrieveData(WithCredential:completion:) for Swift instead.
Has anyone an example of an updated method?