title: NestJs Passport jwt unknown strategy
body: <p>I am trying to implement a JWT strategy for authentication in my nest application.<br>
  I am getting the following error tho</p>
  
  <blockquote>
    <p>Unknown authentication strategy "jwt"</p>
  </blockquote>
  
  <p>This is my code:<br>
  <code>jwt.strategy.ts</code></p>
  
  <pre class="lang-js prettyprint-override"><code>import { Injectable } from "@nestjs/common";
  import { PassportStrategy } from "@nestjs/passport";
  import { Strategy } from "passport-local";
  import { ExtractJwt } from "passport-jwt";
  import { jwtConstants } from "./constants";
  
  @Injectable()
  export class JwtStrategy extends PassportStrategy(Strategy) {
    constructor() {
      super({
        jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
        ignoreExpiration: false,
        secretOrKey: jwtConstants.secret,
      })
    }
  
    async validate(payload: any) {
      console.log(payload);
      return { userId: payload.sub, username: payload.username };
    }
  }
  </code></pre>
  
  <p>My Authentication Module:<br>
  <code>authentication.module.ts</code> </p>
  
  <pre class="lang-js prettyprint-override"><code>import { Module } from '@nestjs/common';
  import { AuthenticationService } from './authentication.service';
  import { UsersModule } from 'src/users/users.module';
  import { PassportModule } from '@nestjs/passport';
  import { LocalStrategy } from './local.strategy';
  import { JwtModule } from '@nestjs/jwt';
  import { jwtConstants } from './constants';
  import { JwtStrategy } from './jwt.strategy';
  
  @Module({
    providers: [
      AuthenticationService,
      LocalStrategy,
      JwtStrategy
    ],
    imports: [
      UsersModule,
      PassportModule,
      JwtModule.register({
        secret: jwtConstants.secret,
        signOptions: { expiresIn: "1d" },
      })
    ],
    exports: [AuthenticationService]
  })
  export class AuthenticationModule {}
  </code></pre>
  
  <p>And I am trying to use it in the following controller:<br>
  <code>users.controller.ts</code></p>
  
  <pre class="lang-js prettyprint-override"><code>import { Controller, Post, Body, Put, Param, Get, UseGuards } from '@nestjs/common';
  import { User } from './user.entity';
  import { UsersService } from './users.service';
  import { JwtAuthGuard } from 'src/authentication/jwt-auth.guard';
  
  @Controller('users')
  export class UsersController {
    constructor(private readonly usersService: UsersService) {}
  
    @UseGuards(JwtAuthGuard)
    @Get()
    async getAll(){
      return this.usersService.findAll();
    }
  }
  </code></pre>
  
  <p>The Users Module looks like this:<br>
  <code>users.module.ts</code></p>
  
  <pre class="lang-js prettyprint-override"><code>import { Module } from '@nestjs/common';
  import { TypeOrmModule } from '@nestjs/typeorm';
  import { User } from './user.entity';
  import { UsersService } from './users.service';
  import { UsersController } from './users.controller';
  
  @Module({
    imports: [TypeOrmModule.forFeature([User])],
    providers: [UsersService],
    controllers: [UsersController],
    exports: [UsersService]
  })
  export class UsersModule {}
  </code></pre>
  
  <p><code>JwtAuthGuard</code>is just a class that extends from <code>AuthGuard('jwt')</code>
  I have follow the nestjs authentication guide from the official docs, but cant get it running in my UsersModule</p>