繁体   English   中英

未处理的异常:[firebase_storage/unauthorized] 用户无权执行所需的操作

[英]Unhandled Exception: [firebase_storage/unauthorized] User is not authorized to perform the desired action

我正在做一个项目,将图像从画廊上传到 firebase 存储。 我面临的错误是用户无权执行所需的操作,但我能够执行所有其他操作,例如在 firestore 上为用户制作集合等,但我无法将图像上传到 firebase 存储。

图片附在下面。

我将图像上传到 firebase 存储/火库的代码:代码图像

我使用的规则: Firebase 存储规则

您在屏幕截图中附加的规则是 Cloud Firestore 的。 Firebase 存储有自己的安全规则。 请确保您已从控制台在 Firebase 存储中创建存储桶并设置允许相关用户上传的规则

rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read, write: if request.auth != null;
    }
  }
}

这些规则将允许经过身份验证的用户上传和下载文件。 如果问题仍然存在,请告诉我。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM