Firebase存储安全规则400错误问题“权限被拒绝.无法访问存储区xxxxx-****.appspot.com" [英] Firebase storage security rules 400 error issue "Permission denied. Could not access bucket xxxxx-****.appspot.com"

查看:126
本文介绍了Firebase存储安全规则400错误问题“权限被拒绝.无法访问存储区xxxxx-****.appspot.com"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直从Firebase链接中收到消息错误,说我尝试上传照片时我的React项目中的Firebase存储上传出现400错误...之前一切正常,并且成功上传了图片,但是现在它停止了上传图片,出现以下错误,我不知道问题出在哪里...

I keeps getting message error from firebase link saying 400 error with my firebase storage upload in my react project when trying to upload photo... everything were working fine before and uploads images successfully, but now it stop uploading of photo giving the following error, i don't know where the problem is...

在检查中提示的链接

POST https://firebasestorage.googleapis.com/v0/b/xxxxx-****.appspot.com/o?name=usertemp%2F0rdrGK4MRDRptAMCc3mHDveytJv1%2F0rdrGK4MRDRptAMCc3mHDveytJv1.jpg 400 ()

这是链接响应中的错误

{
  "error": {
    "code": 400,
    "message": "Permission denied. Could not access bucket xxxxx-****.appspot.com. Please enable Firebase Storage for your bucket by visiting the Storage tab in the Firebase Console and ensure that you have sufficient permission to properly provision resources."
  }

这是我的安全

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

我仍然尝试将match更改为/b/xxxxx-****.appspot.com/o,但仍然没有成功

I still tried changing the match to /b/xxxxx-****.appspot.com/o with still no success

推荐答案

这是由于缺少权限所致.您需要检查是否有

This is due to a missing permission. You need to check whether you have

firebase-storage@system.gserviceaccount.com

以具有存储管理员"角色的成员身份.如果您没有,请添加它.这样可以解决问题.

as a member with a "Storage Admin" role. If you don't have one, then add it. That would fix the issue.

这是如何检查和添加权限的步骤.

Here's the step on how you can check and add permissions.

  • 转到云控制台
  • 导航到存储
  • 选择您的存储桶,然后单击显示信息"面板.

您还可以在IAM&中添加缺少的权限.如果需要,请管理员.

You can also add the missing permission in the IAM & Admin if you want.

这篇关于Firebase存储安全规则400错误问题“权限被拒绝.无法访问存储区xxxxx-****.appspot.com"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆