删除后 Firebase 仍在检索 authData [英] Firebase still retrieving authData after deletion

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

问题描述

在我手动删除连接到我的 iphone 模拟器所在的 uid 的帐户后(从 firebase 仪表板),当我运行下面的代码时,它仍在以某种方式进行身份验证和检索 uid.这怎么可能?

After I manually deleted the account connected to the uid that my iphone simulator is on (from firebase dashboard), when I run the code below it's somehow still authenticating and retrieving a uid. How is this possible?

let ref = Firebase(url: "https://moviebuffapp.firebaseio.com/")

override func viewDidLoad() {
    super.viewDidLoad()

    if ref.authData != nil {

        let uid = ref.authData.uid
        print(uid)

推荐答案

删除帐户不会自动使该帐户的当前会话过期.他们当前的会话将一直有效,直到到期.您可以在 Firebase 信息中心设置会话过期间隔.

Deleting an account does not automatically expire the current session(s) for that account. Their current sessions will remain valid until they expire. You can set the session expiration interval in your Firebase Dashboard.

如果您想强制用户登录出,调用ref.unauth().

但一般来说,您可能希望构建授权规则,以防止这些拥有有效令牌的用户从已删除的帐户中更改数据.

But in general you'll likely want to build authorization rules to prevent such users with valid tokens from deleted accounts to make changes to the data.

如果您将用户配置文件保存在您的数据库中,您可以检查该记录是否仍然存在于您的安全规则中:root.child('users').child(auth.uid).exists().

If you keep the user profiles in your database, you can check whether that record still exists in your security rules: root.child('users').child(auth.uid).exists().

另见:

这篇关于删除后 Firebase 仍在检索 authData的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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