请帮助我,了解我在做什么错
从移动应用程序,我将用户登录名发送到Nodejs服务器,为其生成令牌并返回给移动应用程序。在Nodejs中:
app.post('/getToken', (request, response) => {
var uid = request.body.login;
admin.auth().createCustomToken(uid)
.then(function (customToken) {
response.json({ token: customToken });
})
.catch(function (error) {
console.log("Error creating custom token:", error);
});
});
当我从服务器获得令牌时,我调用SignInWithCustomTokenAsync(customToken)
方法。此时,将在“身份验证”的“ firebase”部分中创建一个用户。但是,从数据库中获取数据的任何尝试,都会导致“权限被拒绝”。 Firebase规则:
{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}
为什么该用户未被视为授权用户,我在做什么错?谢谢