Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

183
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!