Aralizer Aralizer - 1 year ago 185
Node.js Question

Secure external links for Firebase Storage on NodeJS server-side

I'm having issues generating external links to files stored in my Firebase Storage bucket.

I'm using Google Cloud Storage for a while now and used this library (which is based on this answer) for generating external links for regular Storage buckets, but using it on the Firebase-assigned bucket doesn't seem to work.

I can't generate any secure HTTPS links and keep getting certificate validation error

stating that my connection is not private. If I remove the 'S' from the HTTPS, the link works.

NOTE: Using the same credentials and private key to generate links for other buckets in my project, works just fine. It's only the Firebase bucket that is refusing to accept my signing...

Answer Source

I recommend using the official GCloud client, and then you can use getSignedUrl() to get a download URL to the file, like so:

  action: 'read',
  expires: '03-17-2025'
}, function(err, url) {
  if (err) {

  // The file is now available to read from this URL.
  request(url, function(err, resp) {
    // resp.statusCode = 200

Per Generate Download URL After Successful Upload this seems to work with Firebase and GCS buckets.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download