Open ostmond opened 4 years ago
constructor() {
super({
userPoolId: '****',
clientId: '***',
region: '****',
},
function(accessToken, idToken, refreshToken, user, cb) {
cb(null, user);
}
})
}
There is no need for validate
function, the cb
callback does all the work - the second parameter is attached as req.user
.
As far as I understand this is NOT A REPLACEMENT for JWT token verification, as this strategy only allows to authorize user using username
and password
in the request body (same thing as new CognitoUser(userData).authenticateUser
from aws-amplify
). I still didn't find a way to properly validate an AWS Cognito JWT token with strategies.
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:
Thanks a lot