Firebase 正在从云Firestore读取:缺少或权限不足。在Xamarin表单应用程序中

Firebase 正在从云Firestore读取:缺少或权限不足。在Xamarin表单应用程序中,firebase,authentication,xamarin,xamarin.forms,google-cloud-firestore,Firebase,Authentication,Xamarin,Xamarin.forms,Google Cloud Firestore,从云Firestore集合读取文档时遇到问题。问题是我得到了一个错误类型的异常:PermissionDenied和此消息“缺少或权限不足” Nuget: FirebaseAuthentication.net(3.6.0) Plugin.CloudFirestore(4.1.0) 我知道请求被视为未经验证,但我真的不知道为什么 如有任何建议,将不胜感激 谢谢 AccountManager.CurrentUserId返回什么值?它返回用户注册时创建的正确用户ID。此id也是我要获取的文档的id。这是

从云Firestore集合读取文档时遇到问题。问题是我得到了一个错误类型的异常:PermissionDenied和此消息“缺少或权限不足”

Nuget: FirebaseAuthentication.net(3.6.0) Plugin.CloudFirestore(4.1.0)

我知道请求被视为未经验证,但我真的不知道为什么

如有任何建议,将不胜感激


谢谢

AccountManager.CurrentUserId
返回什么值?它返回用户注册时创建的正确用户ID。此id也是我要获取的文档的id。这是firebase身份验证中已验证用户id的一部分(出于安全原因,并非全部)0VU0yjh7JwM9。。。。。。。。。。。。。作为一种安全机制,stringUIDs不是一种安全机制。我不知道这里出了什么问题。希望其他人能发现它。我明白了,问题是我想保留上面的安全规则,但我不知道如何实际实现请求以确保request.auth不为null。谢谢你抽出时间来看弗兰克
public async Task<IDocumentSnapshot> GetUserAndPopulate()
    {
        var doc = await CrossCloudFirestore.Current
                         .Instance
                         .Collection("users")
                         .Document(AccountManager.CurrentUserId)
                         .GetAsync();
        return doc;
    }
rules_version = '2';
service cloud.firestore {
    match /databases/{database}/documents {
        match /users/{user_id}{
            allow read, write: if request.auth != null && request.auth.uid == user_id;
        }
    }
}