I have looked on the docs and couldn't find the mention of a file downloading directly to the user from my firebase storage. I saw CORS but is that what I need to use?
I want a user to click on a download symbol on a picture and be able to get it.
Thanks!
CORS is one way of handling http requests, intended to help you control cross-origin requests. That is unrelated to getting a download link for a file in Firebase Storage. What you want is documented here: https://firebase.google.com/docs/storage/web/download-files
Related
Since I was unable to access my Gmail account after using a VPN, is it possible to download real-time Firebase JSON data? I know that Firebase can be deleted using Curl, but what about downloading it? I already have the token and URL for this.
I haven't tried anything yet because I don't know how to do this.
When fetching a resource from the URL I obtain from the function getDownloadURL, I get a 401 Firebase App Check token is invalid.. Is this the correct behavior, or is there a missing step?
At first I thought this was a CORS issue so I updated that according to the documentation, but looking closer at the response, it's clearly an App Check concern.
So in short, can you fetch a signed download URL alongside App Check being enforced? I looked high and low for some documentation related to this, but alas I couldn't find anything.
I am using firebase to allow users to upload their files to the Storage buckets. I was using the getDownLoadURL() to fetch the publicly available URL...however, this comes with an embedded token to allow access to the file.
In my same app, I'm using the Google Document viewer which takes a URL to preview the doc. Unfortunately, the Google Doc Viewer does not work with the firebase URLs's with the embedded token.
In Google Console, on an individual file, I click to make it public. In that case, the URL is now reachable via the https://storage.googleapis.com// format...and I don't need to use the token which works great.
So, what I want to do is mark/make a file public when I'm uploading it to firebase. I have reviewed the firebase docs and there doesn't seem to be a makePublic() method like there is on the Google API's.
Is there a way I can mark a file as public during upload, so that it can be accessed without any token?
The other solution was that I could update the bucket to be accessible, but this makes it totally open to be browsed at https://storage.googleapis.com/, which I don't want to do.
The client-side Firebase APIs don't know anything about the underlying Google Cloud Platform configurations for public content in storage buckets. So that won't be an option.
You will have to involve some backend code to change the object's configuration after it's uploaded. You could set up your own API endpoint via Cloud Functions (or whatever backend you want) to run one of the Google Cloud Storage server SDKs to set the file as public. (You will probably also want some way to authorize that the user calling your API should be able to make this change.)
I'm trying to retrieve video URIs from objects in Google Firebase to display in a Flatlist. If the video at that URI was deleted, I want to catch and remove that item from the Flatlist.
The Image object that comes with ReactNative throws an error when the URI location doesn't have an image, but the Video component from Expo doesn't.
Is there a way to check URIs in JS?
Thank you in advance!
There is no API in the Firebase SDK to check whether a file exists in Cloud Storage. It's actually an interesting idea, so I'd recommend you file a feature request.
In the meantime I can think of two options:
Use the list() or listAll() calls to check what files do exist. If your file is not in the results, it doesn't exist. The main concern here is that if the list of files is long, it might actually be worse off than trying to download the file anyway.
Use the Node.js SDK on a server (or in Cloud Functions) to check if the file exists, and call that from your application code.
It's really simple: I'm manually uploading files to firebase storage (some pictures that I want to use in my app). I need the public http address, but all I can find there is this type of link gs://myapp.appspot.com/logo3.png. How do I get from that to a URL that I can actually use in my browser?
Cloud Storage buckets do not have publicly accessible URLs by default. You have at least two options to get one:
Write some code in your app to get a download URL for the content. I've linked to the instructions for JavaScript, since you haven't indicated the client platform you're working with.
If you're just trying to get a static URL without calling an API, you will have to use the Google Cloud console to mark the entire storage bucket as "public", then build URLs to the content as described in the documentation.