title: Validation a accessToken in NESTJS
body: <p>Im having some issues with validation a jwt in nestjs. Alot of documentation and tutorials show how to create token etc. I just want to validate it and protect graphql resolvers.</p>
  <p>In my jwt.strategy.ts i have this code:</p>
  <pre><code>import { Injectable } from '@nestjs/common';
  import { ConfigService } from '@nestjs/config';
  import { PassportStrategy } from '@nestjs/passport';
  import { passportJwtSecret } from 'jwks-rsa';
  import { ExtractJwt, Strategy } from 'passport-jwt';
  
  @Injectable()
  export class JwtStrategy extends PassportStrategy(Strategy) {
    constructor(private configService: ConfigService) {
      super({
        secretOrKeyProvider: passportJwtSecret({
          cache: true,
          rateLimit: true,
          jwksRequestsPerMinute: 5,
          jwksUri: 'xxxxx',
        }),
  
        jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
        audience: 'urn:microsoft:userinfo',
        issuer: 'xxxxx',
        algorithms: ['RS256'],
      });
    }
  
    validate(payload: unknown): unknown {
      return payload;
    }
  }
  
  </code></pre>
  <p>And in my authz module i have:</p>
  <pre><code>import { Module } from '@nestjs/common';
  import { PassportModule } from '@nestjs/passport';
  import { JwtStrategy } from './jwt.strategy';
  
  @Module({
    imports: [PassportModule.register({ defaultStrategy: 'jwt' })],
    providers: [JwtStrategy],
    exports: [PassportModule],
  })
  export class AuthzModule {}
  
  </code></pre>
  <p>In my resolvers i use the UseGuards decorator:</p>
  <pre><code>  @UseGuards(AuthGuard('jwt'))
  
  </code></pre>
  <p>All this should work, but i get an error:
  <strong>TypeError: Cannot read properties of undefined (reading 'logIn')</strong></p>
  <p>I dont want to do any login, just validate the token.</p>
  <p>ANy tips on this? Have tried google, been at it for hours. Thanks!</p>