Environment
- Xcode version: 10.2.1
- Firebase SDK version: 6.5.0
- Firebase Component: Auth
- Component version: 6.5.0
*swift 5.0.1
I tried to unlink email account. like below code.
Auth.auth().currentUser?.unlink(fromProvider: EmailAuthProviderID) { (user, error) in
if let error = error {
print(error)
}
}
but I got an error,
Error Domain=FIRAuthErrorDomain Code=17016 "User was not linked to an account with the given provider." UserInfo={NSLocalizedDescription=User was not linked to an account with the given provider., FIRAuthErrorUserInfoNameKey=ERROR_NO_SUCH_PROVIDER}
I also tried
let user = Auth.auth().currentUser!
let providerData = user.providerData
for provider in providerData {
Auth.auth().currentUser?.unlink(fromProvider: provider.providerID) { (user, error) in
if let error = error {
print(error)
}
}
}
And I got the same error.
I tried to unlink after reauthenticate the email, but the same result.
GoogleAuthProviderID and FacebookAuthProviderID worked successfully, but only EmailAuthProviderID not worked.
How can I unlink EmailAuthProvider?