FirebaseUI-Android icon indicating copy to clipboard operation
FirebaseUI-Android copied to clipboard

Anonymous user and account conversion to permanent account

Open danielkummer opened this issue 10 years ago • 100 comments

Hi there

Is there a way in which AuthUI supports the conversion of a anonymous account to a permanent one (one of the supplied auth providers) As stated in the documentation and as I understand it, one must use the linkWithCredential method instead of the "normal" signInWith flow.

Can this be done with the current AuthUI version somehow?

danielkummer avatar May 19 '16 14:05 danielkummer

Hi Daniel,

We don't have any direct support in FirebaseUI for upgrading anonymous accounts to an account backed by an authentication method just yet. You can do it directly with the Firebase Auth APIs, see here in the section "Convert an anonymous account to a permanent account".

I'll leave this issue open as a feature enhancement request; we can likely handle this automatically within FirebaseUI if an existing anonymous user is present in auth.getCurrentUser() when sign in occurs during the authentication flow.

iainmcgin avatar May 19 '16 19:05 iainmcgin

Hi @iainmcgin - thanks for your reply (and considering it as a feature enhancement :) )

I've read through the documentation you mentioned - maybe you can answer me this: Is there a way to get the AuthCredential object from AuthUI which was used by the user to sign-in? As I'm reading the docs, without this object instantiated with the users credentials there's not way to link accounts...

danielkummer avatar May 20 '16 07:05 danielkummer

Ah, we have a slight problem here after discussing this with some colleagues. There is deliberately no way to get back an AuthCredential from an existing user, to avoid potentially leaking credentials. So, the linking of the authentication method to the anonymous account would have to occur within Firebase UI if you are using the library. I'll take a look at this next week to get you unblocked ASAP.

iainmcgin avatar May 20 '16 23:05 iainmcgin

Great - looking forward to hearing from you 👍 (And thanks a lot!)

danielkummer avatar May 23 '16 14:05 danielkummer

Facing similar case. My app uses default anonymous login to provide a frictionless experience while being able to store user data. Log-in (non anonymously) is a secondary optional feature if the user wants to save his data between devices or access specific features. So my app doesn't really have a true logout status and instead rely on anon/non-anon statuses.

1 - Simple scenario; An anonymous user with some local data decides to sign up with X provider (new account). In this case FirebaseUI creates a new user instead of linking the new credentials to the current anonymous user. Moreover the new user is loged in without a warning, so the anon user is lost for ever. ¿Wouldn't be a good default behaviour to try to link the credentials first? In case an account for those credentials already exists linkWithCredential will return an exception which can be handled as follow (see scenario 2)

2 - Complex scenario: An anonymous user tries to sign in (to an existing account). In this scenario we have 2 users and I guess it should be managed by the developer. So some sort of callback/result.

I see how this is problematic due to the potential complexity of second case, but at least the 1st case can be solved very easily by trying to link 1st new credentials when an anonymous user is in.

guillermomuntaner avatar Jun 09 '16 19:06 guillermomuntaner

@iainmcgin Any updates on this? I'm blocked on the same issue and wondering if I will need to fork FirebaseUI to proceed...

drewhannay avatar Jul 04 '16 01:07 drewhannay

~~Same issue here ! Waiting for a fix...~~ In fact, I'm using firebase oauth for a web app, so I'll post in the relevant github project.

pcarbonn avatar Jul 06 '16 19:07 pcarbonn

I'm quite keen on this feature too.

janakagamini avatar Aug 11 '16 06:08 janakagamini

Looking forward for this enhancement on both Android and iOS

pantos27 avatar Aug 13 '16 08:08 pantos27

Has this feature been implemented in the 0.5.1 release? I'm also really looking forward for this.

shalama avatar Aug 29 '16 14:08 shalama

@shalama this has not been implemented yet. It's something we are looking into for future releases though.

You can see exactly what changes with each release by visiting the release notes: https://github.com/firebase/FirebaseUI-Android/releases

samtstern avatar Aug 29 '16 15:08 samtstern

+1 for the feature request

GaborPeto avatar Nov 13 '16 11:11 GaborPeto

Hi @iainmcgin , we have the same feature requirement. Does team have any workaround for this? Hope you can have a response :)

bobshao avatar Dec 08 '16 07:12 bobshao

@bobshao Unfortunately, there aren't any workarounds as mentioned above, but I'm going to be able to work on #309 again so I'm hoping for it to cut FirebaseUI v1.1.0 which will be coming out soon.

SUPERCILEX avatar Dec 08 '16 07:12 SUPERCILEX

Thanks very much for your quick response :) @SUPERCILEX

bobshao avatar Dec 08 '16 07:12 bobshao

It looks like 1.1.0 is shaping up at #510. Will #309 be included in the version?

curiousily avatar Jan 11 '17 08:01 curiousily

@curiousily this will not be making it into the 1.1.0 release due to cross-platform issues. We don't have an implementation on iOS yet.

samtstern avatar Jan 12 '17 15:01 samtstern

@samtstern thanks for the info. Will love to hear any plans concerning when this will be merged.

curiousily avatar Jan 12 '17 18:01 curiousily

Any progress on this? This feature would be great for an app I'm working on.

percula avatar Feb 06 '17 21:02 percula

@percula #309 is ready to be merged, but it's waiting on https://github.com/firebase/FirebaseUI-iOS/issues/139.

SUPERCILEX avatar Feb 06 '17 22:02 SUPERCILEX