Howto get req.user in services in Nest JS
问题 In a controller, I add the user object with a guard, inject some service and call that service to get some response. I have removed a lot of code for brevity. @Controller() @UseGuards(AuthGuard()) export class UserController() { constructor(private readonly userService: UsersService) { } @Get(':id') async findOne(@Param('id') id) { return await this.userService.findOne(id); } } Since I have the AuthGuard , I now know the user is logged in before entering :id route. In the service I would do