稍后删除Firebase匿名用户 [英] Delete Firebase anonymous users after a while

查看:150
本文介绍了稍后删除Firebase匿名用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用匿名身份验证来允许我的用户在未登录的情况下使用应用程序。但是,Firebase似乎无限期地持续保留这些匿名用户ID。有没有办法自动清除这些或设置某种到期规则?我不希望这些一次性使用的ID永远活着,并混淆了来自提供者的实际用户数据。

是一个内存泄漏(用户泄漏?)由于没有合理的方法来强制匿名用户转换,这些匿名用户id很快就会成为没有特定用途(我能想到)的僵尸。此外,单一的真实用户可能(忘记)以匿名用户的身份登录,而在他们的电子邮件已经链接到之前的化身之后再次尝试链接到他们的电子邮件时会感到沮丧。总的来说,我发现目前匿名用户的实现是不切实际的,或者至少远非理想。

现在我计划有一个随机的电子邮件地址,一个给定的用户/设备登录匿名用户,而不是使用内置的匿名登录(这是禁用)。在我看来,需要设置一个设置,告诉Firebase在退出时删除一个匿名用户ID(无论如何都是无用的),并且/或者在预定义的时间之后。此外,使用相同的匿名用户ID再次登录可能是有用的,直到过期时间(如通过保存令牌/等)。最后,尝试链接已经使用的电子邮件应该只需通过验证步骤将匿名用户标识与现有的电子邮件/密码用户标识合并即可。


I am using anonymous auth to allow my users to use the app without logging in. However, Firebase seems to persist these anonymous user IDs indefinitely. Is there a way to automatically purge these or set some sort of expiration rule? I don't want these one-time use IDs to live forever and clutter the actual user data from providers.

解决方案

Unfortunately this is a "memory leak" (user leak?) Since there is no reasonable way to force an anonymous user to convert, these anonymous user ids will soon become zombies that serve no particular purpose (that I can think of). Furthermore, a single real user might (forgetfully) sign in as an anonymous user, yet again, after already linking their email to a previous incarnation, and then get frustrated when trying to link to their email. Overall, I find the current anonymous user implementation impractical, or at very least far from ideal.

For now I am planning to have an email address which is random but unique for a given user/device for signing in anonymous users, instead of using the builtin anonymous signin (which is disabled). In my opinion there needs to be a setting to tell Firebase to delete an anonymous user id upon sign out (they are useless at that point anyway) and/or after a predefined amount of time. In addition, it might be useful to be able to sign in again, with the same anonymous user id, until the expiration time (like by saving a token/etc.) Lastly, an attempt to link an email that is already in use should just merge the anonymous user id with the existing email/password user id through a verification step.

这篇关于稍后删除Firebase匿名用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆