rea*_*roo 21 firebase google-cloud-functions google-cloud-firestore firebase-security-rules
我真的希望能够通过仅允许firebase函数写入特定集合来保护我的firestore db ......我将如何去做?看那里的文档我找不到任何可能说明你怎么做的东西.例如,我正在寻找类似的东西:
service cloud.firestore {
match /databases/{database}/documents {
// Match any document in the 'cities' collection
match /cities/{city} {
allow read;
allow write: if <from firebase function>;
}
}
}
Run Code Online (Sandbox Code Playgroud)
Dou*_*son 39
Firebase代码的云功能通常使用Firebase Admin SDK访问其他Firebase产品.无论如何设置权限,Admin SDK都将具有对Firestore的完全读写权限.您既不能明确允许也不能拒绝访问Admin SDK,这意味着您也无法明确允许或拒绝访问Cloud Functions.
如果您只是希望后端读取和写入数据库的某些部分而不是您的移动客户端应用程序,则只需拒绝完全访问所有客户端,并让Admin SDK完成其工作.
service cloud.firestore {
match /databases/{database}/documents {
// Match any document in the 'cities' collection
match /cities/{city} {
allow read: if false;
allow write: if false;
}
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3633 次 |
最近记录: |