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

190
Visualizações
NestJS Set AccessToken in an HttpOnly Cookie

I am implementing JWT in NestJS + Angular but I am not sure if I am doing it correctly.

Here is my endpoint:

@Post('sign-up')
  async signUp(
    @Body() data: SignUpModelInterface,
    @Res({ passthrough: true }) response: Response
  ): Promise<void> {
    const token: string = await this.authService.signUp(data);

    response.cookie('access-token', token, { httpOnly: true });
  }

Is that the correct way to create a new user and set the access token in the response? You can also see that I am not returning any value from the endpoint (i.e., Promise<void>) but again I am not sure if it is the correct manner.

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

0

I'd suggest returning something even just a simple { success: true } or similar, to make it easier to say that it ended, even just a return statement, to make the flow of code more apparent, but this would be fine for setting the access-token cookie as an HttpOnly cookie

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