在Firestore中创建文档之前,我使用Node.js后端进行一些验证。也就是说,如果所有检查都通过,我将使用firebase-admin代表某些用户创建文档。在Firestore中,我设置了一些安全规则,比如: ...通常,当用户在前端登录时,request.auth.uid由Firebase.auth()填充,这不是我的情况。SEND uid along with this:
db.collection('some_collection').doc('my_doc
我正在搜索以在Firestore数据库中添加一个规则。规则是,如果文档等于request.auth.uid,则允许写入文档。我不知道如何在规则中搜索我的文档的名字。这是我的代码,这里缺少这部分: match /databases/{database}/documents {
match /users/{anyDocument= null && reques
因此,在尝试设置我的firestore数据库时,我有一个名为Users的集合来存储用户信息。我还为每个用户提供了Towers的子集。我的用户文档有一个playerUid字段,我将其用于安全设置。以下是我当前的安全规则: match /databases/{database}/documents { allow read: if request.auth.uid != null;
允许访问用户配置文件和子集合,只有当他们是当前的auth用户时,根据我对文档的读取,我认为通配符可以实现这一点. allow read,write: if user == request.auth.uid我只能通过显式的匹配子集合来让它工作. allow read,write: if user == request.auth.uid;
match/groups
有关如何基于request.auth.uid字段使用Firestore安全规则保护数据的Firestore documentation 。这些代码通常如下所示: match /databases/{database}/documents {
match /stories/{storyidOnly the authenticated user who authored the document can read