Marcus Gallegos
Marcus Gallegos

Reputation: 1592

How to use Firebase Storage Links?

I've read the documentation and I just don't get the fundamental concept about how to access files.

I want to use Firebase Storage in a web app. I have pre-uploaded images that should be accessible to the public. I see that when you upload from the Firebase Console, you get a link to that asset. I see that the token is in the URL and that you can revoke this token, (See screenshot)

So... is that url with the token supposed to be secret? It would be bad to use that link in public html, right?

If so, how can I generate a public link that I could use in an <img src="link-here.com" /> ?

firebase console image upload screenshot

Upvotes: 0

Views: 497

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317760

is that url with the token supposed to be secret?

It's a secret that gets shared with everyone who should be able to access the object.

It would be bad to use that link in public html, right?

Only if that would expose access to those who should not be able to download the object.

how can I generate a public link that I could use in an ?

Follow the instructions in the documentation for downloading data via URL. You will use getDownloadURL() to asynchronously get a URL that has the token embedded in it.

Upvotes: 1

Related Questions