I am trying to allow the user to unlink their twitter account from the edit profile page in my iOS app, but I keep getting this error:
User was not linked to an account with the given provider.
Even though when I check the email in the console and compare to firebase dashboard, and the email is indeed linked to twitter. I tried looking at the firebase docs but don't see a list of what to put for the providerString anywhere. I tried "Twitter", "twitter" , "TwitterProvider" and get the same result.
here is my code:
Auth.auth().currentUser?.unlink(fromProvider: "Twitter",
completion: { (data,error) in
if let data = data {
debugPrint("data \(data)")
} else {
debugPrint("whats happening here?: \(error?.localizedDescription)")
debugPrint(Auth.auth().currentUser?.email!)
}
})
If I attempt to link twitter again, I get:
"[ERROR_PROVIDER_ALREADY_LINKED] - User can only be linked to one identity for the given provider." UserInfo={NSLocalizedDescription=[ERROR_PROVIDER_ALREADY_LINKED] - User can only be linked to one identity for the given provider., error_name=ERROR_PROVIDER_ALREADY_LINKED}
I believe it should be the providerId twitter.com
:
Auth.auth().currentUser?.unlink(fromProvider: "twitter.com", ...