一段时间后删除 Firebase 匿名用户 [英] Delete Firebase anonymous users after a while

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

问题描述

我使用匿名身份验证来允许我的用户在不登录的情况下使用该应用程序.但是,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.

推荐答案

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

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.

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

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天全站免登陆