繁体   English   中英

Firebase 存储错误“所需的引用中不存在对象,并且没有用于请求的身份验证令牌”

[英]Firebase storage error "No object exists at the desired reference and no auth token for request"

当我尝试在我的 firebase 存储中获取文件的下载 URL 时,我不断收到此错误,我不知道问题是什么了,我尝试了很多方法

    Exception has occurred.
FirebaseException ([firebase_storage/object-not-found] No object exists at the desired reference.)

W/StorageUtil(32618): no auth token for request
W/NetworkRequest(32618): no auth token for request
E/StorageException(32618): StorageException has occurred.
E/StorageException(32618): Object does not exist at location.
E/StorageException(32618):  Code: -13010 HttpResult: 404

这是我的存储规则

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

这是我的代码

 return   GridView.builder(
                
    shrinkWrap: true,
  itemCount: snapshot.data.documents.length,
  gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
    crossAxisSpacing: 20, 
    mainAxisSpacing: 20,
    childAspectRatio: 1.7,
      crossAxisCount:2),
  itemBuilder: (BuildContext context, int index) {

    checkItems =  FirebaseFirestore.instance
        .collection('items');

checkItems = checkItems..where('id',isEqualTo: user_id.toString()); 

    DocumentSnapshot thesnapshot = snapshot.data.docs[index]; 


    
                                                              printUrl() async {
    Reference ref = 
        FirebaseStorage.instance.ref().child('antivirus.jpg');
       
       var togo = (await ref.getDownloadURL()).toString();
    setState(() {
      url =  togo;
    print('here is your url duuuuuuuuuuuuuuuuuuuuuudreeeeeeeeee'+url);
    });
    
}

printUrl()

………………………………………………………………………………………………………………………………………………………… ………………………………………………………………………………………………………………………………………………………… ………………………………………………………………………………………………………………………………………………………………………………

我遇到了同样的问题,我修复了从方法中删除扩展名的问题,尝试如下:

 Reference ref = 
    FirebaseStorage.instance.ref().child('antivirus');

它对我有用。

暂无
暂无

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

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