首页 > 解决方案 > 加载资源失败:服务器响应状态为 403

问题描述

我正在使用Github的 Firestorage / Firebase 教程项目。项目描述在这里

看来是精心设计的,所以我猜问题是我自己的无知。

使用我的 GMail 凭据登录后,我遇到以下错误,并且我的头像图像未显示:

Initiator: platform-browser.js:1213
GET https://lh5.googleusercontent.com/-vz7Fxnqe9Mo/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucnJJZ_Itph8fgRsQrR9saxjY1RytQ/s96-c/photo.jpg
Error 403

当我想显示用户的 GMail 头像时会发生这种情况。

即使在隐身浏览器窗口中,我也可以导航到此图像,所以我不明白为什么我的应用程序无法显示它。

我认为它与 Firestorage 无关,但无论如何我都会在这里发布我的 Firestorage 规则:

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

我在 http://localhost:4200/ 本地运行项目

在 Firebase 中,我在授权域列表中有“localhost”。

我可以检查什么来追踪问题?

标签: angularfirebaseangular-cli

解决方案


It seems that localhost doesn't work here.

Once deployed on my server, it worked fine.

Would be nice to know what the problem is though.


推荐阅读