Angular Firestore访问用户文档

时间:2020-04-19 09:15:36

标签: angular google-cloud-firestore angularfire2

我正在使用这种方法来吸引用户

 getUsers(userUid): Promise<void|Users> {
    return this.firestore
      .collection(this.collectionName)
      .doc(userUid)
      .ref
      .get()
      .then(
        res => res.data() as Users
      ).catch(
        err => this.handleErr(err)
      );
  }

安全规则为:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /users/{userId} {
      allow read, write: if request.auth.uid == userId;
    }
  }
}

访问文档ID与userUID相同的文档时权限不足

0 个答案:

没有答案
相关问题