You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FirebaseUI version: master branch (Using SPM to add to SwiftUI project)
CocoaPods Version: N/A
Step 3: Describe the problem:
In my Firebase console authentication providers I have setup Google, Apple and Github as described in the Firebase UI doco. I also have also checked and enabled the automatic account linking option.
In my code (SwiftUI app) I have setup FirebaseAuthUI like this:
So as to provide Apple, Google and Github sign on.
I can sign in using either Apple or Google and the Firebase console shows an account with my ID and both providers linked.
If I then try to sign on using Github I get the error
Error Domain=FIRAuthErrorDomain Code=17012 "An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address." UserInfo={FIRAuthErrorUserInfoNameKey=ERROR_ACCOUNT_EXISTS_WITH_DIFFERENT_CREDENTIAL, [email protected], FIRAuthErrorUserInfoUpdatedCredentialKey=<FIROAuthCredential: 0x6000009af520>, NSLocalizedDescription=An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.}
If I remove the account via from the Firebase console, then sign in using Github it works and creates an account with the GitHub provider.
If I then sign out and sign back in with a Google or Apple, it also logs in successfully. However when I check the Firebase console the GitHub provider has been removed from the account and replaced with the Google or Apple provider I signed in with.
It appears that the GitHib provider does not want to play nice with other providers.
Can you tell me if I'm doing anything wrong?
The text was updated successfully, but these errors were encountered:
I've now managed to solve one problem. Specifically the problem where the GitHub provider won't sign on if there is an Apple or Google provider already registered. I did it with this code:
extensionSecurity:FUIAuthDelegate{func authUI(_:FUIAuth, didSignInWith user:User?, error:Error?){
if let error {letnsError= error asNSError
if nsError.code ==AuthErrorCode.accountExistsWithDifferentCredential.rawValue {
pendingAuth = nsError.userInfo[AuthErrorUserInfoUpdatedCredentialKey]as?AuthCredential}
signOnViewModel.error = error
return}
if let user {
if let pendingAuth {Auth.auth().currentUser?.link(with: pendingAuth){ result, error inself.pendingAuth =nil}}}}
Essentially this is a hack of the code I found on the Firebase site for dealing with AuthErrorCode.accountExistsWithDifferentCredentials. I found that if there is already a registration with the same email but a different provide, then when I attempt to sign in with the GitHub provider it throws this error.
In my code I then stash the GitHub credentials and ask the user to sign in with a different provider. Once they do that, it then uses the stashed GitHub credentials to link the GitHub provider.
it works in that I end up with one registration with both GitHub and Apple/Google providers attached.
However it's not a great user experience.
Nor does it solve the issues of registering Appel/Google after GitHub removing Github as a provider.
I've tried poking around in Auth.auth() and FUIAuth.defaultAuthUI() but I've not been able to find anything that will tell me what has already been registered for a specific email. I've called Auth.auth().fetchSignInMethods(forEmail:...) but it always returns an empty array.
Step 3: Describe the problem:
In my Firebase console authentication providers I have setup Google, Apple and Github as described in the Firebase UI doco. I also have also checked and enabled the automatic account linking option.
In my code (SwiftUI app) I have setup FirebaseAuthUI like this:
So as to provide Apple, Google and Github sign on.
I can sign in using either Apple or Google and the Firebase console shows an account with my ID and both providers linked.
If I then try to sign on using Github I get the error
If I remove the account via from the Firebase console, then sign in using Github it works and creates an account with the GitHub provider.
If I then sign out and sign back in with a Google or Apple, it also logs in successfully. However when I check the Firebase console the GitHub provider has been removed from the account and replaced with the Google or Apple provider I signed in with.
It appears that the GitHib provider does not want to play nice with other providers.
Can you tell me if I'm doing anything wrong?
The text was updated successfully, but these errors were encountered: