Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR resolves #16
If a user is already logged in, lit tries to link the credential to their account. Thus, anonymous users can upgrade to a non-anonymous account. If that credential is already associated with an account, lit will call the
LinkMergeConflictCallback
(if non-null) to resolve the merge conflict. The developer is responsible for merging data (from Firestore, Realtime Database, etc) within that callback, using thecredentialForLinking
to sign-in as the new user and migrate the data.Note, there is a bug with the FirebaseAuthOAuth plugin where no exception is thrown when there is already an existing account. I've created an issue in that repo to address it. Unfortunately, that means that account merging only works for sign in methods that use
FirebaseAuthFacade.signInWithCredential()
. Once that issue is resolved, we can simply catch the exception and returnAuth.failure(AuthFailure.linkMergeConflict(e.credential))
. I'm hoping the credential will be in the exception, but if not I'm not sure how to handle that.