Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

347
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda