【发布时间】:2016-04-11 05:26:22
【问题描述】:
我不明白为什么通过 authWithCustomToken(secret,funct()) 进行身份验证的节点服务器似乎没有获得管理员权限:
myFirebaseRef = new Firebase(url);
myFirebaseRef.authWithCustomToken(secret,function(error, authData) {
if (error) {
console.log(currTime() + " [CONFIG] ... Firebase authentication failed!", error);
} else {
console.log(currTime() + " [CONFIG] ... Firebase authentication succeeded, authData : " + JSON.stringify(authData));
}
}
身份验证似乎成功:
07:13 [CONFIG] ... Firebase 身份验证成功,authData : {"auth":null,"expires":null,"token":"","uid":null,"provider":"custom "}
当我的服务器尝试更新孩子时:
FIREBASE 警告:在 /bd/google:112747494449447764778/9782871294917 更新失败:permission_denied
我的客户端代码已正确验证并获得预期的权限。
我的规则:
{
"rules": {
".read": true,
"bd": {
".read": true,
"$usernode": {
".read": true,
".write": "auth != null && auth.uid == $usernode"
}
}
}
}
有什么提示吗?
【问题讨论】:
-
你确定认证成功了吗?因为 auth 为空
-
在这种情况下我不应该得到错误吗?另外,有什么方法可以在我的 firebase 端调试安全性?
-
此线程表明,当使用秘密而不是 JWT 时,身份验证数据应为空。 stackoverflow.com/questions/29594308/…
标签: firebase firebase-security