Cannot integrate Passport.js with AWS Cognito in Nestjs
jacobdo2 opened this issue · 1 comments
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.
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.