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

181
Vistas
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 Respuestas
Responde la pregunta

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 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