【问题标题】:Firebase Storage authentication issuesFirebase 存储身份验证问题
【发布时间】:2017-03-16 02:03:30
【问题描述】:

我正在尝试从 Firebase 存储下载图像,但出现错误。

E/StorageUtil: error getting token java.util.concurrent.ExecutionException: com.google.android.gms.internal.zzanu: Please sign in before trying to get a token.
W/NetworkRequest: no auth token for request

但是,我的规则是这样设置的:

service firebase.storage {
    match /b/<myappnameredacted>.appspot.com/o {
        match /{allPaths=**} {
            allow read, write;
        }
    }
}

【问题讨论】:

    标签: firebase firebase-authentication firebase-security firebase-storage


    【解决方案1】:

    您的规则与Firebase Storage Security Rules Documentation 中的不同。

    要公开所有文件(对任何人),请使用:

    // Anyone can read or write to the bucket, even non-users of your app.
    // Because it is shared with Google App Engine, this will also make
    // files uploaded via Google App Engine public.
    
    service firebase.storage {
      match /b/{bucket}/o {
        match /{allPaths=**} {
          allow read, write;
        }
      }
    }
    

    为了使您的所有文件都可读(对任何人),请使用:

    service firebase.storage {
      match /b/{bucket}/o {
        match /{allPaths=**} {
          allow read;
        }
      }
    }
    

    您也可以只使您的图像可读/可写,请参阅Firebase Storage Security Rules Documentation

    【讨论】:

      猜你喜欢
      • 2021-07-30
      • 1970-01-01
      • 1970-01-01
      • 2017-06-07
      • 1970-01-01
      • 2021-12-09
      • 2021-04-21
      • 2020-12-22
      • 2020-11-27
      相关资源
      最近更新 更多