Skip to content

Provide FlowParameters for linking credentials to authenticated users #1823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tynn opened this issue Aug 3, 2020 · 6 comments
Open

Provide FlowParameters for linking credentials to authenticated users #1823

tynn opened this issue Aug 3, 2020 · 6 comments
Labels

Comments

@tynn
Copy link

tynn commented Aug 3, 2020

The SignInIntentBuilder.enableAnonymousUsersAutoUpgrade() provides a configuration for linking credentials to an anonymous user. It would be nice to utilize this implementation to link credentials to authenticated users as well. This is especially useful for adding a phone number to an existing users or vise versa.

This might relate to #309.

Steps to reproduce:

  1. Start AuthUI with two providers (e.g. Google and Phone)
  2. Sign in with Google
  3. Repeat 1.
  4. Sign in with Phone

Observed Results:

  • A new user was created with the phone number provided in 4.

Expected Results:

  • The phone number was added to the user signed in in 2.

Relevant Code:

From AuthOperationManager.java

public Task<AuthResult> signInAndLinkWithCredential(@NonNull FirebaseAuth auth,
                                                    @NonNull FlowParameters flowParameters,
                                                    @NonNull AuthCredential credential) {
    if (canUpgradeAnonymous(auth, flowParameters)) {
        return auth.getCurrentUser().linkWithCredential(credential);
    } else {
        return auth.signInWithCredential(credential);
    }
}

public boolean canUpgradeAnonymous(FirebaseAuth auth, FlowParameters flowParameters) {
    return flowParameters.isAnonymousUpgradeEnabled() && auth.getCurrentUser() != null &&
            auth.getCurrentUser().isAnonymous();
}
@sam-gc
Copy link
Contributor

sam-gc commented Aug 5, 2020

Hi, thanks for the feature request! I've added this to our internal tracking (b/162980103).

@FanciROS
Copy link

FanciROS commented Dec 3, 2021

Hello @sam-gc,
Have you any news about this feature ?
Best Regards,

@sam-gc
Copy link
Contributor

sam-gc commented Dec 3, 2021

Hi @FanciROS, unfortunately no updates for now

@danijorda1
Copy link

Hi, any update on this? I'd be great to use Auth UI flow for Linking accounts via linkWithCredential

@danijorda1
Copy link

I saw this is already solved here 309
@samtstern seems this issue has been resolved perfectly great by @SUPERCILEX and still not avialble officially. Wouldn't it make sense to make the improvement avialble ? Even if IOS version is not alligned with this feature it doesn't make sense to hold the feature any longer for android users, specially since this has been avialble since 2017 or even before. Having the feature avialable will also encourage IOS team to deliver the feature sooner.... otherwise we will be waiting and waiting for an already avialble feature that is super helpful and mostly needed. Thanks in advance @samtstern , and also thanks a lot @SUPERCILEX for developing this super useful feature!

@danijorda1
Copy link

@sam-gc do you have rights to proceed, and resolve the conflicts in 309 and merge the pull request ? 309 is the solution for this. Thanks!

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

No branches or pull requests

5 participants