Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

364
Vistas
How do I fix 'Permission Denied' when I'm downloading a file from Firebase?

My project uses Firebase authentication and storage, and is built using React JS.

I have a file which is in the storage bucket at:

gs://myproject.appspot.com/myfolder/fileId

The download URL with token is:

https://firebasestorage.googleapis.com/v0/b/myproject.appspot.com/o/myfolder%2FfileId?alt=media&token=myToken

I want to be able to download the file in my app, so I have the following function within the Firebase class:

  doDownloadFile = (path: string) => {
    app
      .storage()
      .ref()
      .child(path)
      .getDownloadURL()
      .then((url) => {
        console.log(url);
      })
      .catch((error) => {
        console.log('Error: ', error);
      });
  };

(at the moment I'm just getting the URL, not downloading it).

The value of path is the downloadURL as given above (I've checked this by logging it at the top of the doDownloadFile function, and it's being passed in ok).

When I run this code, I get the following error:

Firebase Storage: User does not have permission to access 'https:/firebasestorage.googleapis.com/v0/b/myproject.appspot.com/o/myfolder%2FfileId?alt=media&token=myToken'. (storage/unauthorized)

On Googling I found 2 general solutions to this, but neither have worked for me.

The first is to set the security rules on the storage in the Firebase console. I've set this to:

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

The second is to add the user firebase-storage@system.gserviceaccount.com as Storage Admin in the GCP console. This has been done.

Neither of these has made any difference, though. I still get the same error.

Where am I going wrong?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda