【发布时间】:2018-08-07 13:31:08
【问题描述】:
不知道为什么我在访问 AngularFirestoreCollection 时遇到此错误:
ERROR 错误:权限缺失或不足。
this.categories = afs.collection('categories').doc(this.afAuth.auth.currentUser.uid).collection<Category>('categories');
Firestore 数据库规则:
service cloud.firestore {
match /databases/{database}/documents {
match /categories/{userId}{
allow read, write: if request.auth.uid == userId;
}
}
}
我在这里错过了什么?
【问题讨论】:
-
从您的代码看来,您正试图访问
/categories/{userId}/categories,但您的规则仅适用于/categories/{userId}。尝试将其更改为match /categories/{category=**} {。
标签: firebase google-cloud-firestore angularfire2 firebase-security