我目前有安全规则,允许用户只从名为"153“的集合中读取。
在Android中,我访问Firestore并调用Firestore实例上的.collection("153").get()...从该集合中检索数据。
相反,如果Android代码读取.collection("999").get...,则该权限将被拒绝,这是应该的。
安全规则:
service cloud.firestore {
match /databases/{database}/documents {
// FULL ADMIN ACCESS
match /{docum
我有一个简单的加密货币应用程序,它使用API来获取价格。我使用Firestore来存储我的API密钥,我的应用程序在启动时从Firestore中检索我的API密钥。我的API键是我在Firestore中拥有的唯一数据。由于我的应用程序不允许用户创建配置文件/帐户,所以我的规则中不包括用户身份验证。我对Firestore的安全规则是:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /Data/{Data} {
allo
有关如何基于request.auth.uid字段使用Firestore安全规则保护数据的Firestore documentation 。这些代码通常如下所示:
service cloud.firestore {
match /databases/{database}/documents {
match /stories/{storyid} {
// Only the authenticated user who authored the document can read or write
allow read, write: if request.au
我定期更新模拟器的Firestore数据,使其尽可能接近生产。
我最近更新了Auth模拟器打开的自定义索赔逻辑。我的任何用户都不能通过uid从Admin访问(因为他们不在模拟器中)。
根据文档更新索赔:
getAuth()
.setCustomUserClaims(uid, { admin: true })
.then(() => {
// The new custom claims will propagate to the user's ID token the
// next time a new one is issued.
});
我(愚蠢地
我在努力保护我的火力基地。
我这样做是为了保护我的用户列表。
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /about/{id} {
allow read: if true;
allow write: if request.auth.uid != null;
}
match /avantages/{id} {
allow read: if true;
all
我有一个很大的注册列表,我希望将其显示在最常用的前5个列表中,如下所示:
我不知道使用Firebase Cloud Firestore查询此类操作会是什么样子。要从subject中的集合中检索数据,我使用以下命令:
getUserRegistrations() {
var user = firebase.auth().currentUser;
var userUID = user.uid;
db
.collection("registrations")
.orderBy("date", "desc")
.
我有以下规则,这些规则应该允许我读取文档,但我得到了权限不足错误。有什么建议吗?
当前用户在名为users的集合下有一个文档,其中名为role的字段的值为admin
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId}/tickets/{ticketId} {
allow update, delete, create: if false
allow read: if get(/users/$(request.auth.uid
我正在使用Dart,Flutter和Firebase制作一个应用程序。有注册/登录,我使用云firestore作为数据库。在我的云firestore中,用户UID是文档id,我有每个用户的特定数据(结果)。 我只想检索当前用户的数据(存储在Firestore中)并显示在屏幕上。This is my cloud firestore image void submitit(double n, m) async {
final FirebaseUser user = await FirebaseAuth.instance.currentUser();
final String usr = user
我对云firestore的安全规则有一个理解上的问题。我不明白如何使用用户可以访问其数据的映射来检查用户的uid。 提前感谢您的回答 ? 以下是我尝试过的规则 rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
//TEST ONLY
//match /{document=**} {
// allow read, write;
//}
// match logged in user doc in