火力警告:设置在 /users/simplelogin:32 失败:permission_denied
FIREBASE WARNING: set at /users/simplelogin:32 failed: permission_denied
之前在我的应用程序中我一直在成功创建帐户,直到我设置了一些规则
{
"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
由于您希望用户最初能够创建他们自己的节点,因此您需要明确允许位置是新的。
基于documentation on the auth
parameter:
".write": "!data.exists() || auth.uid === $uid""
注意:我不完全确定这是否可行,但我觉得它在答案格式中比在 "try this" 评论中更具可读性。
之前在我的应用程序中我一直在成功创建帐户,直到我设置了一些规则
{
"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
由于您希望用户最初能够创建他们自己的节点,因此您需要明确允许位置是新的。
基于documentation on the auth
parameter:
".write": "!data.exists() || auth.uid === $uid""
注意:我不完全确定这是否可行,但我觉得它在答案格式中比在 "try this" 评论中更具可读性。