title: making handleRequest an async method on passportjs guard
body: <pre><code>@Injectable()
  export class RefreshAuthGuard extends JwtAuthGuard {
      constructor(
          private readonly jwtService: JwtService,
      ) {
          super();
      }
      public handleRequest(err: any, user: any, info: Error, ctx: any): any {
          if (err || !user) {
              if (info.name === 'TokenExpiredError') {
                  const request: Request = ctx.getRequest();
                  const headers: IHttpRequestHeaders = request.headers as IHttpRequestHeaders;
                  const refresh_token = headers.refresh_token;
                  if (!this.isValidRefreshToken(refresh_token)) {
                      throw new HttpException('Invalid refresh token', HttpStatus.UNAUTHORIZED);
                  }
              } else {
                  throw new HttpException('Unauthorized', HttpStatus.UNAUTHORIZED);
              }
          } else {
              throw new HttpException('Expired tokens only', HttpStatus.FORBIDDEN);
          }
      }
  
      private isValidRefreshToken(refresh_token: string): boolean {
          return !!refresh_token;
      }
  }
  </code></pre>
  
  <p><strong><em>Problem:</em></strong></p>
  
  <p>If I add <code>async</code> to the method and make it return <code>Promise&lt;any&gt;</code> for now it says:</p>
  
  <pre><code>Property 'handleRequest' in type 'RefreshAuthGuard' is not assignable to the same property in base type 'JwtAuthGuard'.Type '(err: any, user: any, info: Error, ctx: any) =&gt; Promise&lt;any&gt;' is not assignable to type '&lt;TUser = any&gt;(err: any, user: any, info: any, context: any, status?: any) =&gt; TUser'. Type 'Promise&lt;any&gt;' is not assignable to type 'TUser'
  </code></pre>
  
  <p>I really need these methods to be async so that I could retrieve user's refresh_token from the DB and validate it inside this guard. I need these operations async.</p>
  
  <p>EDIT:</p>
  
  <p>this piece is from the nestjs source code:</p>
  
  <pre><code>export declare type IAuthGuard = CanActivate &amp; {
      logIn&lt;TRequest extends {
          logIn: Function;
      } = any&gt;(request: TRequest): Promise&lt;void&gt;;
      handleRequest&lt;TUser = any&gt;(err: any, user: any, info: any, context: any, status?: any): TUser;
  };
  export declare const AuthGuard: (type?: string | string[]) =&gt; Type&lt;IAuthGuard&gt;;
  
  </code></pre>
  
  <p>So it looks that the method can't be asynchronous...</p>