【发布时间】:2022-02-17 07:08:16
【问题描述】:
所以我正在开发一个用户可以使用用户名创建帐户的项目。这个用户名应该是唯一的,我必须在 Firebase 实时数据库中设置规则。我对设置这些感到非常困惑。我找到了一些关于此的帖子,但没有奏效,这是我目前的规则:
{
"rules": {
"users": {
"$uid": {
".write": "auth !== null && auth.uid === $uid",
".read": "auth !== null && auth.provider === 'password'",
}
},
"usernames" : {
".write" : "true",
".read" : "true",
".validate" : "!root.child(\"username\").exists()"
}
}
}
这是数据模型: I made a screenshot, how it looks in the database
希望有人能帮帮我!
【问题讨论】:
标签: json database firebase firebase-realtime-database