We have firebase nodejs functions where we get base64 image data from our partner site. This data we are storing into firebase storage like below:
const storageRef = admin.storage().bucket(bucketName)
const fileRef = storageRef.file('myimage.png')
await fileRef.save(base64Image)
The bucket used here for this purpose has readonly true so security is not a concern. How do I get the url of the image stored in bucket to put in my realtime db?
In UI way, I can directly upload image from the firebase console and can see the link. I need this link.
Based on my research on google, I see getting a download url is an issue on server side due to security of the bucket and you need to get signedUrl that expires. In my case as it is public so I am hoping there's a way to get the url.
An alternate way would be to bypass the bucket completely and store the base64 image directly into realtime db, but I'm not comfortable with that due to very large length of base64 strings. My images ideally would be in the range of few kbs.
How to deal with this?