mikenicholson / passport-jwt

Passport authentication using JSON Web Tokens
MIT License
1.97k stars 215 forks source link

Cannot integrate Passport.js with AWS Cognito in Nestjs #205

Closed jacobdo2 closed 4 years ago

jacobdo2 commented 4 years ago

I am trying to integrate AWS Cognito with Passport.js in a Nestjs project. When I declare a Passport strategy as follows:

export class JwtStrategy extends PassportStrategy(Strategy) {
  constructor(private readonly authService: AuthService) {
    super({
      jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
    });
  }

It states on the AWS Amplify github page that their Javascript SDK does not support using secret https://github.com/aws-amplify/amplify-js/tree/master/packages/amazon-cognito-identity-js#user-content-configuration, but having this information gives me an error that "JwtStrategy requires a secret or key". Passing the secretOrKey as null or '' does not work, so I am wondering if there is a way to use Passportjs and AWS Cognito together.

mikenicholson commented 4 years ago

Unfortunately, I'm not able to troubleshoot code or integration with unrelated APIs. If you discover a reproducible issue with this module please open an issue with a unit test, succinct code snippet or detailed instructions to reproduce.

Consider asking a question on stack overflow. Best of luck.