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

115
Vistas
Firebase Storage Security Rules request being denied

I'm trying to build a basic social media site with profile photos that any user can read, but each user can edit only their own photo. I wrote it after reviewing the documentation here https://firebase.google.com/docs/storage/security/rules-conditions

and when I use the simulator on the storage settings with a test authenticated user I get a success

Here is a photo of the successful test read: https://i.stack.imgur.com/ZCF5L.png

But I also have tried running this on my deployed app and each request no matter read or write, authenticated or not, I keep getting my request declined

failed storage request from deployed app

These are my security rules:

service cloud.firestore {
  match /b/{bucket}/o {
    match /internal/profilePhoto/{imageId} {
         allow read: if request.auth != null;
     allow write: if request.auth.uid == imageId;
        }
  }
}

and here is my code with the address I'm requesting from

async function upload(file, currentUser, setLoading) {
   const fileRef = ref(storage, 'internal/profilePhoto/'+currentUser.uid);

   setLoading(true);

   console.log(currentUser.uid)
   const snapshot = await uploadBytes(fileRef, file);

  const photoURL = await getDownloadURL(fileRef);

   updateProfile(currentUser, {photoURL});

   setLoading(false);
   alert("Uploaded file!");
}

Any guidance would be greatly appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I figured it out. I opened another app with the default testing storage settings and my code let me upload to that database. I looked back at my FIREBASE STORAGE security settings and noticed that that first line said

service cloud.fireststore {

That was my problem. I accidentally copied in a rule setting for cloud firestore which left my storage database without any security rules which I assume made the default no access. If you want to set a rule setting for firebase storage than that rule needs to be

service firebase.storage {

I hope this saves at least one person a few hours of head banging.

The full rule setting I'm using for testing is

rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**}{
     allow read, write: if true;
    }
  }
}
about 4 years ago · Juan Pablo Isaza Denunciar
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