How to Store "direct link" to an image using Firebase Storage

how to store vegetables in kitchen
how to store fruits and vegetables chart
how to store vegetables in fridge for long time
how to store vegetables in fridge without plastic
how to store carrots
how to store oranges
how to store broccoli
how to store apples

I need to access an image stored on Firebase Storage by a direct link, eg

http://myfirebasehost.com/storage/imgIwant.png

For all I know, it can only this type of URL using the protocol gs://, however, it is not accessible by link, only in the SDK api.

I need a solution exactly as described above using the Firebase platform, if not possible, accept other suggestions.

My code has constants that are links to images. It turns out that if I want to update this picture, I have to make a new deployment. Instead I want to update the image at the same URL. It would be impossible to do this with the firebase (to my knowledge) because the URL provided by Storage is not accessible by link.

Another alternative might be to convert an image to base64 and stored in the database, but would be very extensive and impractical.

With Firebase Storage, you're given two URLs that you can use to represent files:

// "Private" internal URL, only accessible through Firebase Storage API
// This is protected by Firebase Storage Security Rules & Firebase Auth
gs://bucket/object

// "Public" unguessable URL, accessible by anyone with the link
// This is secured because that token is *very* hard for someone to guess
https://firebasestorage.googleapis.com/v0/bucket/object?alt=media&token=<token>

The first option requires that you use the reference.getDownloadURL() method to convert the internal gs:// URL into a public https:// URL.

The second option allows you to share this public but unguessable URL with trusted individuals, and allows them to access content without authentication to Firebase or using your app--think sharing family photos with Google Photos. Likely this behavior will be good enough, unless you desire public sharing with clean URLs. You can use this URL in a browser, or use any other HTTP library to download it. We provide the ability to download these files as well (off a reference), so you don't need to get a third party library, you can just use us.

I strongly recommend reading our docs for more information on this.

How to store food so it lasts longer, plus what not to do, Highly gaseous produce items, like bananas, avocados, and apples, should be stored away from each other and other fruits and veggies. Tip: To ripen, keep at room temperature in a paper bag until soft. Peas, English and in pods Refrigerator: 4 days Tip: Leave them in the pods until ready to eat. Pineapple Countertop: 5 days (whole) Refrigerator: 3 days (sliced) Plums Refrigerator: 5 days Tip: To ripen, keep at room temperature until soft and the skins develop a silvery, powdery coating.

How to translate your gs storage location to a direct url by example:

gs://nobs-f32f2.appspot.com/profile/1s_by_wlop-dc1sdan.jpg

becomes

https://firebasestorage.googleapis.com/v0/b/nobs-f32f2.appspot.com/o/profile%2F1s_by_wlop-dc1sdan.jpg?alt=media

1st be sure to URL escape your blob path. For example, swap forward slashes (/) for %2F and spaces () for %20.

2nd be sure you've open read access where needed. Here is an open rule to get moving:

service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read: if true;
      allow write: if request.auth != null;
    }
  }
}

How To Store Turnips In 'Animal Crossing: New Horizons', I'd argue that the best way to store turnips in this game is to dedicate a room in your house, but if you're dropping 1 million+ bells every Sunday  Store your potatoes in a cool, humid, and dark place (45 to 50 F is the ideal temperature range). If you have an unheated basement, that's a perfect spot for your potatoes. An insulated garage or shed might also work during the winter. Never store potatoes in the fridge. The too-cold temperature turns the potato starch into sugar.

For those who just want to get a link

In console > Storage

Select a specific photo and you will see the link below.

How to Store Food in the Refrigerator So It Stays Fresh Longer , The Smartest Way to Store Foods in the Refrigerator for Long-Lasting Freshness. Follow these tips to keep all your ingredients and leftovers  To store potatoes, first place them in an open bag, basket, or other ventilated container since closed containers make potatoes spoil faster. Then, store the potatoes in a cool, dry, dark place, like a pantry or your basement. Don’t keep raw potatoes in the fridge since the cold temperature can change how they taste.

The Best Way to Store Bread, A collection of the best ways to store bread in your home kitchen to keep it fresh, longer. Keep it out of the fridge and on the counter! How to Store Potatoes. Your potatoes should be stored in a cool, dark, dry place, such as a pantry or cupboard. Use a storage container that is well-ventilated, such as a crate, a cardboard box with holes punched in it or any container that will allow any excess moisture to evaporate.

How to Store Everything in Your Home, One of the biggest contributors to household clutter is not knowing how to properly store your items. It's time to get organized and put everything  If the onions are homegrown, cure them before storing them. They'll mold if you don't. Avoid storing onions near other produce. Many fruits and vegetables will absorb the onion's flavor. Onions can also be stored in mesh bags or long braids. Expect your onions to last up to eight months in storage.

How to store weed: How long is it good for?, Find out about storage options to keep your marijuana fresh for longer. Learn more about the best ways to store weed at Leafly.com. Store the macarons in a sealed container with an airtight seal. Make sure that the lid is tight and that air will not penetrate inside. Otherwise, macaron will end up soggy and dry. Keep the macaron in the pantry if you are ready to consume it within the day. On the other hand, if you are not yet ready, keep it in the fridge.

Comments
  • You seem to have a problem getting your code to work. The best way to get help with that on Stack Overflow is to reproduce the problem in a minimal amount of code and post that code here.
  • If you would like to share this link to the graph API with link=downloadURL, facebook logs the error: error link should represent a valid URL.
  • Does the token ever change? I'd like to save the full URL in the database associated with an object and use it later. (without using getDownloadUrl on a child)
  • @DoruChidean the token changes when you overwrite the file, or if you invalidate the token in the web console.
  • From backend perspective this answer is not useful. The mobile users don't have secure way to access the firebase store (except if they have account). So I have to create them download url , but there is not such method in the python Admin API or such REST functionality. So firebase give me no choice but to give public access (and I don't want to), or to have service that downloads the image through the backend using Google cloud storage and not firebase storage. So looks to me like the backend APIs or the admin API, is last concern, targeting mostly mobile users making firebase escape hard.
  • why token is needed when I can directly access the file from https://firebasestorage.googleapis.com/v0/bucket/object?alt=media ?
  • I didn't think the URL would work when missing the "token" parameter in the query string. Yet, I just tried it and no problem. +1
  • Is it possible to not have the ?alt=media ?