-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Anonymous user and account conversion to permanent account #123
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
Comments
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 |
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... |
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. |
Great - looking forward to hearing from you 👍 (And thanks a lot!) |
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; 2 - Complex scenario: 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. |
@iainmcgin Any updates on this? I'm blocked on the same issue and wondering if I will need to fork FirebaseUI to proceed... |
|
I'm quite keen on this feature too. |
Looking forward for this enhancement |
Has this feature been implemented in the 0.5.1 release? I'm also really looking forward for this. |
@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: |
+1 for the feature request |
Hi @iainmcgin , we have the same feature requirement. Does team have any workaround for this? Hope you can have a response :) |
Thanks very much for your quick response :) @SUPERCILEX |
@curiousily this will not be making it into the |
@samtstern thanks for the info. Will love to hear any plans concerning when this will be merged. |
Any progress on this? This feature would be great for an app I'm working on. |
@percula #309 is ready to be merged, but it's waiting on firebase/FirebaseUI-iOS#139. |
Thanks @SUPERCILEX ! Looks like there's good activity on the iOS side now. Beginner question: I want to use your implementation of Anonymous Auth linking, so I cloned your fork. Then I followed the instructions to install the repository to Maven Local |
@percula if you change the version number in |
@percula @samtstern Whoa whoa whoa, you guys aren't being lazy enough! 😄 I would just use JitPack if I were you. Once you follow step one on their website (add the maven reop), you can just add my fork like so: compile 'com.github.SUPERCILEX.FirebaseUI-Android:firebase-ui-auth:d1df8d2c0aef03f3db008d4021059ba316386c7c' That's way easier to start and to keep yourself up to date with my fork. Cheers! 🎉 |
@SUPERCILEX I can't believe Jitpack works with our crazy build system. Very impressive. |
@samtstern Yeah, it took a while for me to figure out, but it would have been too much of a pain to re-compile everything every time I wanted to test it in my own app. Basically because we have several modules, instead of |
@j2emanue You can't and this is acceptable behavior. I agree that it triggers our internal developer's need for cleanliness, but there's no nice way to ensure the account has been fully migrated and also delete the account. (By the time the migration is done, it's too late to delete the account.) Sorry for not being able to provide a better answer! 😊 |
What I'm doing at the moment to sort this out is to use firebase functions to delete the anonymous user, and copy/delete(Anonymous) its current data in case of a new sign in or just delete the anonymous user data in case of concurrent signin. |
Thanks for sharing, that's a cool idea! Not something we can do in the library, but good to know as individual developers. |
@GuanacoDevs thank you for the feedback. can you show code how you are deleting an account based on anonymous_user_uid only ? i see to delete an account i call currentUser.delete(). i dont see how your getting the anonymous user by uid ? your not even logged in anymore as the anonymous user so how can the account be deleted ? although with the admin sdk i see a way: FirebaseAuth.getInstance().deleteUserAsync(uid).get(); |
@j2emanue Hey man, I meant Google Cloud Functions, not within your App, using GCF you can delete any user even if is not signed In. Delete User. Regards |
@GuanacoDevs Silent sign-in is ready on my side, just waiting on @samtstern's approval. 🙃 |
Hey @SUPERCILEX, What (stable?) commit hash from your branch would you recommend that targets Play Services 15? Thanks for your response. Our team already implemented your suggestions! Cheers! |
@curiousily Sweet! I'd go with |
Hey @SUPERCILEX , Did this made it to the v4.0.0? If not what would be the last stable commit hash from your branch? Is it the same from Apr 25 Thanks a lot! |
@GuanacoDevs and where do you merge the data from anonymous user with the new signed in user? We are talking about linking an anonymous account with a user account on the sign in process, no? |
@unxavi @GuanacoDevs I think there is some confusion. The new "silent sign-in" feature is not related to this issue at all. Anonymous upgrade has not been shipped. |
@unxavi @samtstern Apologies, I read my previous post here and not the title of the issue, got confused. |
Hey @SUPERCILEX, Any new recommended hash that includes the changes in 4.0? Would you recommend a way to select hashes by ourselves, so I don't bother you every now and then? Not even #1185 made it into 4.0... Sorry to bother you again. Thanks for the hard work you're putting in! |
@unxavi @curiousily no worries about asking for new hashes. 😊 (Though if you go to the |
@mike1128 The point is that it's anonymous. 😉 So basically, you just call |
I want them in the same page. So user can choose sign in with facebook or email or sign in anonymously from one interface. |
@mike1128 This isn't something the user interacts with though. Typically, you'd call |
Thank you for your replying. But it doesn't solve the problem. If I call signInAnonymously(), I should give user a button. so it's two interface or page, not one. what i want it like this startActivityForResult( and then Handling the sign-in response like |
I see what you're saying, but the whole point of |
what if user want to sign in on app start? |
Oh, I think I see where you're confused. Anonymous sign-in isn't persisted anywhere. That means if the user re-installs your app one way or another they'll lose all their data. The point of my fork is that you sign in anonymously on app start so you can use the db and all that, then when the user is ready to sign-in after going through tutorials or something, you present them with a reliable sign-in method. |
Hi all, Some basic support for this feature has been released in version |
I'm going to attempt to clarify and organize what's going on so this post can be used as a starting point for any newcomers. Current state of affairsPublic releases of FUI include support for non-conflicting upgrades. What does that mean? If a user only has an anonymous account and then signs up for a real account, you're good to go. However, anytime the user is signed in anonymously but already has a real account, you'll run into a merge conflict which can't be resolved nicely. BTW, when I say "real" account, I mean something with a stable ID like an email or phone. What does the fork do?Simply put, it lets you resolve merge conflicts by transferring a user's data to their real account with security rules in mind. How do I get it?Setup JitPack with this repo: Documentation can be found here: https://github.com/SUPERCILEX/FirebaseUI-Android/blob/anonymous-auth/auth/README.md#account-linking |
Hi, folk. I found a method called I don't know when it was added but I think it answers the question.
|
@SUPERCILEX , can you please comment on this Edit: Just looked at the documentation. They appear to be similar. The key difference is "When linking is unsuccessful due to user collision, an error with code ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT will be returned to onActivityResult()". So instead of passing a merge conflict class, you handle it in |
Hi @SUPERCILEX could you please create a new build with firebase-ui-auth:8.0.0 ? Phone Auth is not working in higher versions of Android with firebase-ui-auth:4.2.0 Thanks a lot! |
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?
The text was updated successfully, but these errors were encountered: