Skip to content

Is it possible to integrate the passport-cognito into Nest.js? #34

@ostmond

Description

@ostmond

Hi, Is it possible to integrate the passport-cognito into Nest.js by using PassportStrategy and AuthGuard? I found the JwtStrategy worked only for Auth0 and would like to customize a CognitoStrategy extends PassportStrategy(Strategy), something like following in TypeScript:

import { Strategy } from 'passport-cognito';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable, Logger } from '@nestjs/common';

@Injectable()
export class CognitoStrategy extends PassportStrategy(Strategy) {
  private readonly logger = new Logger(CognitoStrategy.name);

  constructor() {
    super( // please help here...);
  }

  async validate(payload: any) {
    this.logger.log('payload: ', payload);
    return payload;
  }
}

Thanks a lot

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions