GeezerVison is showing github.com — Handling anonymous user upgrade merge conflicts: Wrong error code · Issue #1435 · firebase/FirebaseUI-Android
Handling anonymous user upgrade merge conflicts: Wrong error code #1435DescriptionHi!
I am following the documentation, to see if I don't need @SUPERCILEX 's fork anymore.
Documentation states that:
When linking is unsuccessful due to user collision, an error with code ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT will be returned to onActivityResult()
However, I am not getting this error code. I am getting ErrorCodes.UNKNOWN_ERROR instead.
The IdpResponse I get is:
IdpResponse{mUser=null, mToken='null', mSecret='null', mIsNewUser='false', mException=com.firebase.ui.auth.FirebaseUiException: Fake exception created, original: com.firebase.ui.auth.FirebaseUiException: Unknown error, original cause: com.firebase.ui.auth.FirebaseAuthAnonymousUpgradeException: User account merge conflict, mPendingCredential=null}
Scenario to reproduce:
User has signed in with a google account on my app.
Change device or simply clear the data of my app on the phone, to be signed out from the app.
Log in anonymously.
Connect account using: enableAnonymousUsersAutoUpgrade()
Then on onActivityResult(...) I get the IdpResponse shown above.
Am I missing something? Activitysamtstern commented on Sep 5, 2018 @NikiFoD I am not able to reproduce this with the sample app in this repo. Here's what I did:
- Open the sample app AuthUI activity, sign in with Google
- Clear data
- Open the sample app Anonymous upgrade activity
- Sign in anonymously
- Sign in with Google
The merge worked as expected. NikiFoD commented on Sep 6, 2018 @samtstern I went through the sample app and found the problem.
When the sample app tries to upgrade the account from Anonymous it calls:
public void startAuthUI() {
List<AuthUI.IdpConfig> providers = ConfigurationUtils.getConfiguredProviders(this);
Intent intent = AuthUI.getInstance().createSignInIntentBuilder()
.setLogo(R.drawable.firebase_auth_120dp)
.setAvailableProviders(providers)
.setIsSmartLockEnabled(false)
.enableAnonymousUsersAutoUpgrade()
.build();
startActivityForResult(intent, RC_SIGN_IN);
}
Try removing the line below and you'll get the error I got.
.setIsSmartLockEnabled(false)
So, the anonymous upgrade doesn't work with smart lock.
Is this a bug or the intended behaviour? In @SUPERCILEX 's fork, it does work with smart lock and I don't see a reason why it would be better to exclude it, but if this is the case, please have it written in the documentation, cause it's not clear for other devs.
Thanks samtstern commented on Sep 6, 2018 @NikiFoD nice catch! I was able to reproduce and I think I found the issue. Reacted by Nikiforos Doukas samtstern commented on Sep 6, 2018 @SUPERCILEX the anonymous upgrade error is detected properly but it somehow gets lost in IdpResponse serialization. Digging into it... samtstern commented on Sep 6, 2018 Reacted by Juhani Lehtimäki and Enrico Martelli Reacted by Nikiforos Doukas samtstern commented on Sep 12, 2018 This was fixed and released in version 4.2.0 JuhaniLehtimaeki commented on Sep 14, 2018 4.2.0 does not fix this issue to me the requestCode is still returned as 0 even after updating to 4.2.0 NikiFoD commented on Sep 14, 2018 For me, the problem I described is solved and working fine.
Maybe there is another problem you are running into? (I never had a problem with requestCode) zafersnger commented on Oct 8, 2018 I have the same issue with phone authentication. I receive "User account merge conflict" error when I enable enableAnonymousUsersAutoUpgrade()
com.firebase.ui.auth.FirebaseAuthAnonymousUpgradeException: User account merge conflict
at com.firebase.ui.auth.viewmodel.SignInViewModelBase.handleMergeFailure(SignInViewModelBase.java:35)
at com.firebase.ui.auth.data.remote.SignInKickstarter.onActivityResult(SignInKickstarter.java:189)
at com.firebase.ui.auth.KickoffActivity.onActivityResult(KickoffActivity.java:81)
at android.app.Activity.dispatchActivityResult(Activity.java:7256)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4468)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4515)
at android.app.ActivityThread.-wrap22(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1687)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
Reacted by Francis and Eyuphan
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|