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

342
Vistas
login with mails added to checklist -javascript

Have a realtime db login auth rules.

When I enter the mails manually, the mails I authorize gain access, there is no problem. Here is code:

{
  "rules": {
    ".read": "
                 auth.token.email == \"xx@qq.co\"  
                 || auth.token.email == \"yy.yy@yy.co\" 
                 || auth.token.email == \"ss@ss.com\"
    ",
      
    ".write": true
  }
}

But my idea:

{"emails":{"xx@hotmail.com", "qq@gmail.com"},
{
  "rules": {
    ".read": "auth.token.email == emails",
      
    ".write": true
  }

and realtime db code screenshot:

enter image description here

any idea this issue?

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

That second snippet looks like invalid syntax for Firebase security rules, and thus won't work (it actually shouldn't even save when you enter that in the Firebase console).

If you want a dynamic list of user to gain access, the idiomatic way is to store their UIDs in the database and then check against that in your security rules.

So for example, you could have this in the database:

"uidsThatAreAllowedToRead": {
  "uid1": true,
  "uid2": true,
  "uid3": true
}

And then in your read rule check against that with:

".read": "root.child('uidsThatAreAllowedToRead').child(auth.uid).exists()"

You could do the same with email addresses, but you'd have to encode them as keys cannot contain . characters which are required in an email address. The common encoding method is to replace each . with a ,, which conveniently is allowed in the database keys but not in email addresses.

about 4 years ago · Santiago Gelvez 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