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

283
Visualizações
Realtime FireBase Database rules - where is auth.token located in a fetch request?

I wanted to know where a auth.token variable is located on a normal js fetch request.

For example, I have these rules:

{
  "rules": {
    ".read": "auth.token=='tokenhere'",
    ".write": "auth.token=='tokenhere'",
  }
}

Like a simple password system,

now I wanted to know where that auth.token would go in a fetch request in order to succeed these rules.

Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can't pass along custom information to the security rules. The only things available in your rules are:

  1. The path that the user is reading from or writing to.
  2. The data that the user is writing, if this is a write operation.
  3. The auth variable, if there is an authenticated user.

So if you want to test anything in your security rules, it'll have to be in one of these fields.

For example, if I want to store data that can only be accessed if the user knows some specific secret (like a password), I typically encoded that secret into the path to that data.

{
  "rules": {
    "correcthorsebatterystaple": {
      ".read": true,
      ".write": true,
    }
  }
}

With the above rules the user can only read/write the data if they somehow know the secret "correcthorsebatterystaple" value.

about 4 years ago · Juan Pablo Isaza 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