Question · NestJS course · Module 4: Authentication

req.user object after JWT authentication

Where does the req.user object in a protected endpoint come from after passing through JwtAuthGuard?

Answer options

  • It is returned from the validate() method in JwtStrategy
  • It is fetched from the database on every request
  • It is created automatically by NestJS
  • It is sent by the frontend in the request body

You can check the correct answer by solving this task in the CodeWorlds game.