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

137
Visualizações
How should I have API users send their keys?

I'm building an API in NodeJS and an SDK for people who want to use the API to make requests to it. When someone wants to make a request, they have to pass an API key to the method they're using. For example, a request would look something like messages.send({body: "Hello"}, "key_randomKey");.

Is it safe to send keys in requests? In this scenario, the key would be passed as a request property, it would be accessed on the actual backend server for the API and then hashed there and compared to the one in the database (keys are also created on the backend server, not on the server making the request). Is this the wrong approach? I'm wondering how to do this securely.

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

0

I would suggest you send the key in the authorisation header as bearer token instead.

Use an http Interceptor of some sort in the frontend which will clone every api call and add the authorisation header with the key to it. Then on the backend you can access the token, ideally via a middleware and compare and verify it with the database.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization

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