After uploading a file in Firebase Storage with Functions for Firebase, I'd like to get the download url of the file.
I have this :
...
return bucket
.upload(fromFilePath, {destination: toFilePath})
.then((err, file) => {
// Get the download url of file
});
The object file has a lot of parameters. Even one named mediaLink
. However, if I try to access this link, I get this error :
Anonymous users does not have storage.objects.get access to object ...
Can somebody tell me how to get the public download Url?
Thank you
firebaser here
Version 11.10 of the Admin SDK for Node.js adds a getDownloadURL()
method. An example of how to use it can be found in the documentation on getting a shareable URL:
const { getStorage, getDownloadURL } = require('firebase-admin/storage');
const fileRef = getStorage().bucket("my-bucket").file("my-file");
const downloadURL= await getDownloadURL(fileRef);