【发布时间】:2021-12-18 19:45:31
【问题描述】:
我使用显示名称更新Profile。然后我尝试在数据库安全规则中访问此显示名称。但是数据库上的 displayName 没有更新。
这是在 Flutter 中使用 Firebase 实时数据库。
代码:
await referencedData.firebaseAuth.currentUser.updateProfile(
displayName: 'gameName' //that only the players know about
);
在我的规则中,我有:
".write": "!data.exists() ||
auth.displayName == data.child('gamename').val()",
//规则意味着没有数据存在,所以所有者可以创建一个新游戏或
//游戏名已经在数据库中设置了,我知道这个游戏名,并且在显示名中,所以我可以写删除
我花了 3 天或更长时间来搜索文档或示例。关于在哪里看有什么想法吗?
【问题讨论】:
标签: firebase flutter firebase-realtime-database firebase-security