title: Nestjs:validate function not working with jwt
body: <p>I'm trying to use jwt in nest following <a href="https://i.stack.imgur.com/gEi0O.png" rel="noreferrer">document</a></p>
  
  <p>Everything is ok, but validate function is not working in jwt.strategy.ts</p>
  
  <p>this is my jwt.strategy.ts:</p>
  
  <pre class="lang-js prettyprint-override"><code>import { Injectable, UnauthorizedException } from '@nestjs/common';
  import { PassportStrategy } from '@nestjs/passport';
  import { ExtractJwt, Strategy } from 'passport-jwt';
  import { AuthService } from './auth.service';
  import { JwtPayload } from './interfaces/jwt-payload.interface';
  
  @Injectable()
  export class JwtStrategy extends PassportStrategy(Strategy) {
    constructor(private readonly authService: AuthService) {
      super({
        jwtFromRequest: ExtractJwt.fromAuthHeaderWithScheme('JWT'),
        secretOrKey: 'secretKey',
      });
    }
  
    async validate(payload: JwtPayload) {
      console.log(payload)
      // const user = await this.authService.validateUser(payload);
      // if (!user) {
      //   throw new UnauthorizedException();
      // }
      // return user;
    }
  }
  </code></pre>
  
  <p>auth.module.ts:</p>
  
  <pre class="lang-js prettyprint-override"><code>
  import { Module } from '@nestjs/common';
  import { JwtModule } from '@nestjs/jwt';
  import { PassportModule } from '@nestjs/passport';
  import { AuthService } from './auth.service';
  import { JwtStrategy } from './jwt.strategy';
  
  @Module({
    imports: [
      PassportModule.register({ defaultStrategy: 'jwt' }),
      JwtModule.register({
        secretOrPrivateKey: 'secretKey',
        signOptions: {
          expiresIn: 3600,
        },
      }),
    ],
    providers: [AuthService, JwtStrategy],
  })
  export class AuthModule {}
  
  </code></pre>
  
  <p>app.module.ts:</p>
  
  <pre class="lang-js prettyprint-override"><code>import { Module } from '@nestjs/common';
  import { AppController } from './app.controller';
  import { AppService } from './app.service';
  import { TypeOrmModule } from '@nestjs/typeorm';
  import { UserModule } from './user/user.module';
  import { GraphQLModule } from '@nestjs/graphql';
  import { AuthModule } from './auth/auth.module';
  
  @Module({
    imports: [
      TypeOrmModule.forRoot(),
      GraphQLModule.forRoot({
        typePaths: ['./**/*.graphql'],
      }),
      AuthModule,
      UserModule,
    ],
    controllers: [AppController],
    providers: [AppService],
  })
  export class AppModule {}
  
  </code></pre>
  
  <p>When i request in postman, I don't got any log, It doesn't seem to enter this validate function.:</p>
  
  <p><a href="https://i.stack.imgur.com/gEi0O.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gEi0O.png" alt="enter image description here"></a></p>
  
  <p><a href="https://github.com/flashliu/NestServer" rel="noreferrer">this is Complete code</a></p>
  
  <p>sorry, my English is bad, this is my first-time use stackoverflow, thanks for your help</p>