AuthGuard on Local Strategy return undefinded
PatrykKuniczak opened this issue · comments
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
@Injectable()
export class LocalStrategy extends PassportStrategy(Strategy) {
constructor(private authService: AuthService) {
super();
}
async validate(username: string, password: string) {
username = username.replace(/\s/g, "").toLowerCase();
const user = await this.authService.validateUser({username, password});
if (!user) {
throw new UnauthorizedException()
}
return user
}
}
That's code it's very similiar to this from your docs.
And what the point, after last update
"@nestjs/passport": "9.0.1"
I have an Error in the console, after i throw any error from this authService or manually from this validate func.
Nest wrong handle throwed exeptions, i can throw ep.
throw new BadGatewayException()
My app work fine, but i have a info in the console.
That's work well on 9.0.0 version, only on the latest update this error occure.
Minimum reproduction code
Don't necessary in that case, code from docs it's the same
Steps to reproduce
No response
Expected behavior
Don't console.error(undefined) from AuthGuard :)
Package version
9.0.1
Passport version
0.6.0
NestJS version
9.3.5
Node.js version
19.6.0
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
I using Windows 11, and WebStorm 2022.3.2
Fixed in the latest versions of @nestjs/passport
& @nestjs/core