GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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 #1435

New issue
Copy link
New issue
Copy link
Closed
Closed
Handling anonymous user upgrade merge conflicts: Wrong error code#1435
Copy link
Assignees
samtstern
Labels
authfix-implementedtype: bug
Milestone
4.2.0

Description

@NikiFoD
NikiFoD
opened on Sep 4, 2018
Issue body actions

Hi!

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?

Activity

  1. samtstern commented on Sep 5, 2018

    @samtstern
    samtstern
    on Sep 5, 2018
    Contributor
    More actions

    @NikiFoD I am not able to reproduce this with the sample app in this repo. Here's what I did:

    1. Open the sample app AuthUI activity, sign in with Google
    2. Clear data
    3. Open the sample app Anonymous upgrade activity
    4. Sign in anonymously
    5. Sign in with Google

    The merge worked as expected.

  2. NikiFoD commented on Sep 6, 2018

    @NikiFoD
    NikiFoD
    on Sep 6, 2018
    Author
    More actions

    @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

  3. samtstern commented on Sep 6, 2018

    @samtstern
    samtstern
    on Sep 6, 2018
    Contributor
    More actions

    @NikiFoD nice catch! I was able to reproduce and I think I found the issue.

    Reacted by Nikiforos Doukas
  4. samtstern
    self-assigned this
    on Sep 6, 2018
  5. samtstern
    added
    type: bug
    auth
    on Sep 6, 2018
  6. samtstern
    added this to the 4.2.0 milestone on Sep 6, 2018
  7. samtstern commented on Sep 6, 2018

    @samtstern
    samtstern
    on Sep 6, 2018
    Contributor
    More actions

    @SUPERCILEX the anonymous upgrade error is detected properly but it somehow gets lost in IdpResponse serialization. Digging into it...

    Reacted by Alex Saveau
  8. samtstern
    added
    fix-implemented
    on Sep 6, 2018
  9. samtstern commented on Sep 6, 2018

    @samtstern
    samtstern
    on Sep 6, 2018
    Contributor
    More actions

    @NikiFoD this will be fixed in 4.2.0

    Reacted by Juhani Lehtimäki and Enrico Martelli
    Reacted by Nikiforos Doukas
  10. samtstern commented on Sep 12, 2018

    @samtstern
    samtstern
    on Sep 12, 2018
    Contributor
    More actions

    This was fixed and released in version 4.2.0

  11. samtstern
    closed this as completedon Sep 12, 2018
  12. JuhaniLehtimaeki commented on Sep 14, 2018

    @JuhaniLehtimaeki
    JuhaniLehtimaeki
    on Sep 14, 2018
    Contributor
    More actions

    4.2.0 does not fix this issue to me the requestCode is still returned as 0 even after updating to 4.2.0

    Reacted by Darush
  13. NikiFoD commented on Sep 14, 2018

    @NikiFoD
    NikiFoD
    on Sep 14, 2018
    Author
    More actions

    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)

  14. zafersnger commented on Oct 8, 2018

    @zafersnger
    zafersnger
    on Oct 8, 2018
    More actions

    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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @samtstern
    samtstern

Labels

authfix-implementedtype: bug

Type

No type

Projects

No projects

    Milestone

    • 4.2.0

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.