I am trying to get images from firebase firestore, while trying to get image download url there is this exception :
W/StorageUtil(10206): no auth token for request
(similar questions with this error not solve the problem)
Although my security rules allow read and write I getting this error still.
Any ideas what is the problem with this?
Code for getting image url :
static Future<dynamic> loadImage(BuildContext context, String image) async {
return await FirebaseStorage.instance.ref().child(image).getDownloadURL();
}
Calling this loadImage function :
Future<Widget> getImage(BuildContext context, String imgName) async {
Image image;
await FireStorageService.loadImage(context, imgName).then((value) {
print(value);
image = Image.network(value.toString(), fit: BoxFit.scaleDown);
return image;
});
}
Calling this getImage function :
child: FutureBuilder(
future: getImage(context, "/images/test1.jpg"),
...
)
My firebase storage rules :
rules_version = '2';
service firebase.storage {
match /images/{imageId} {
allow read,write;
}
}
Storage Rules ss:
Navigate to Firebase console
In Sidebar under Develop open Storage
Open Rules tab replace the rule on your console with the rule below:
And Publish Done