DEV Community

Discussion on: Authentication and Sessions for MVC Apps with NestJS

Collapse
 
mendelb profile image
Mendel Blesofsky

Thanks for an awesome tutorial!

One note for anyone who encounters the same issue I did for the logout functionality.

I receieved the following error log when implementing per the article:
Error: req#logout requires a callback function

Passing the res.redirect('/) as a callback to the req.logout method call fixed this.

  @Get('/logout')
  logout(@Request() req, @Res() res: Response) {
    req.logout(() => {
      res.redirect('/');
    });
  }
Enter fullscreen mode Exit fullscreen mode