在我的应用程序之前,我成功创建了帐户,直到我提出了一些规则
{
"rules": {
"users": {
"$uid": {
// grants write access to the owner of this user
// account whose uid must exactly match the key ($uid)
".write": "auth !== null && auth.uid === $uid",
// grants read access to any user who is logged in
// with an email and password
".read": "auth !== null && auth.provider === 'password'"
}
}
}
}
然后,创建帐户是因为我在仪表板中看到了这些帐户。但是一旦我尝试创建,我就会遇到这种错误
FIREBASE WARNING: set at /users/simplelogin:32 failed: permission_denied
答案 0 :(得分:3)
由于您希望用户最初能够创建自己的节点,因此您需要明确允许位置为新的情况。
基于documentation on the auth
parameter:
".write": "!data.exists() || auth.uid === $uid""
注意:我不完全确定这会有效,但觉得它在答案格式中比在“试试这个”评论中更具可读性。