I'm submitting a...
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
export class JwtStrategy extends PassportStrategy(Strategy) {
...
async validate(payload: JwtPayload, done: Function) {
if (!payload) {
return done(new UnauthorizedException(), false)
}
done(null, payload, 'xxxxxxxxx')
}
}
request:
{
...
authInfo: undefined,
user: { id: 123, username: 'admin', iat: 1541730420, exp: 1541734020 } }
}
@nestjs/passport/dist/auth.guard.js
const createPassportContext = (request, response) => (type, options, callback) => new Promise((resolve, reject) => passport.authenticate(type, options, (err, user, info) => {
try {
request.authInfo = info;
console.log(request.authInfo:${request.authInfo}
)
...
it will be executed twice:
request.authInfo:xxxxxxxxx
request.authInfo:undefined
Expected behavior
{
...
authInfo: 'xxxxxxxxx',
user: { id: 123, username: 'admin', iat: 1541730420, exp: 1541734020 } }
}
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Environment
Nest version: 5.4.0
For Tooling issues:
- Node version: 8.12.0
- Platform: Windows
Others: