I was trying to get the Image URL token from firebase storage. I was able to generate the full URL of the image stored in firebase storage but without that token, I can not access it.
I am using Nodejs v16.
fullURL = https://firebasestorage.googleapis.com/v0/b/first-project-17ec7.appspot.com/o/lp.png
const storage = require("firebase/storage");
let storageRef = await storage.ref(fullURL);
storageRef.getDownloadURL().then(function(url) {
console.log(url);
});
Output:
error : TypeError: storageRef.getDownloadURL is not a function
at download (/Users/turinganalytics/Development/transform/src/utils/download.js:51:16)
at async Object.getBuffer (/Users/turinganalytics/Development/transform/src/utils/origin.js:315:30)
Expected Output: https://firebasestorage.googleapis.com/v0/b/first-project-17ec7.appspot.com/o/lp.png?alt=media&token=6d3766fd-b043-4252-8783-b1f7f260d5fd
There are no set of rules in the firebase console.
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
Is there any node js library for firebase that I can retrieve that unique token.?