From c21837ada5787c9e0a762fa3d5a6d261324e038b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Mon, 12 Sep 2022 14:51:56 +0900 Subject: [PATCH] nestjs_auth... --- src/auth/guards/local.strategy.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/auth/guards/local.strategy.ts b/src/auth/guards/local.strategy.ts index 84d71d7..4325973 100644 --- a/src/auth/guards/local.strategy.ts +++ b/src/auth/guards/local.strategy.ts @@ -14,11 +14,10 @@ export class LocalStrategy extends PassportStrategy(Strategy) { //Login인증용 async validate(email: string, password: string): Promise { - const user = await this.authService.validateUser(email, password) - //console.log(user) - if (!user) { - throw new UnauthorizedException() + try { + return await this.authService.validateUser(email, password) + } catch (e) { + new UnauthorizedException(e.message) } - return user } }