Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Skip linking for anonymous users #445

Merged
merged 1 commit into from
Aug 8, 2017

Conversation

witi83
Copy link
Contributor

@witi83 witi83 commented Aug 3, 2017

Should fix #357 and #389 and maybe others as well.

This will avoid the exception com.google.firebase.auth.FirebaseAuthUserCollisionException: This credential is already associated with a different user account.

This issue occurs if you call user.linkWithCredential on a anonymous user, but the authCredential points to another already known firebase user (e.g a facebook account). Instead firebaseAuth.signInWithCredential will be called.

Should fix EddyVerbruggen#357 and EddyVerbruggen#389 and maybe others as well.

This will avoid the exception `com.google.firebase.auth.FirebaseAuthUserCollisionException: This credential is already associated with a different user account`.

This problem occurs if the current user is anonymous, but the `loginResult` points to another already known firebase user (e.g a facebook account). In this case we have to call `firebaseAuth.signInWithCredential(authCredential).addOnCompleteListener(onCompleteListener)` instead of `user.linkWithCredential(authCredential).addOnCompleteListener(onCompleteListener)`
@EddyVerbruggen EddyVerbruggen merged commit 129e1e0 into EddyVerbruggen:master Aug 8, 2017
@EddyVerbruggen
Copy link
Owner

Makes sense to me, thank you!

@witi83
Copy link
Contributor Author

witi83 commented Aug 8, 2017

@EddyVerbruggen Great. Thanks for merging!

@EddyVerbruggen EddyVerbruggen added this to the 4.0.6 milestone Aug 23, 2017
@RaphaelJenni
Copy link
Contributor

@EddyVerbruggen Please revert this merge. Explanation on issue #357

@EddyVerbruggen
Copy link
Owner

Let me think about this for a bit..

@EddyVerbruggen
Copy link
Owner

Thanks, @RaphaelJenni and @witi83, for your constructive discussion in #357 👍

I've now reverted this PR and will push 5.0.2 shortly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't re-authenticate with Google/Facebook on app hard-restart
3 participants