From c6000d3212a630d95d21fd53ec701dae4790b4a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EA=B1=B4=EC=9A=B0?= Date: Mon, 23 Dec 2024 15:15:25 +0900 Subject: [PATCH] =?UTF-8?q?fix/#39/=EB=A6=AC=ED=94=84=EB=A0=88=EC=89=AC=20?= =?UTF-8?q?=ED=86=A0=ED=81=B0=20=EA=B2=80=EC=A6=9D=ED=82=A4=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/auth/auth.controller.ts | 5 +++-- src/auth/jwt/jwt.guard.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index 4e4d8fe..9282939 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get, Res, UseGuards } from '@nestjs/common'; +import { Controller, Get, Post, Res, UseGuards } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport'; import { User } from 'src/common/decorators/get-user.decorator'; import { ConfigService } from '@nestjs/config'; @@ -12,6 +12,7 @@ export class AuthController { constructor( private readonly authService: AuthService, private readonly configService: ConfigService, + private readonly redisService: RedisService, ) {} // Google 로그인 시작 @@ -60,7 +61,7 @@ export class AuthController { @Get('/verify') // @UseGuards(AuthGuard('jwt')) @UseGuards(JwtGuard) - authTest(@User() user: any) { + tokenVerify(@User() user: any) { return user; } } diff --git a/src/auth/jwt/jwt.guard.ts b/src/auth/jwt/jwt.guard.ts index a6ff874..512e10b 100644 --- a/src/auth/jwt/jwt.guard.ts +++ b/src/auth/jwt/jwt.guard.ts @@ -54,7 +54,7 @@ export class JwtGuard implements CanActivate { // refresh 토큰 변조, 만료를 검사 const payload = jwt.verify( accessToken, - this.configService.get('ACCESS_SECRET'), + this.configService.get('REFRESH_SECRET'), ) as any; const { userId } = payload; @@ -88,7 +88,7 @@ export class JwtGuard implements CanActivate { ); } - // Access 토큰을 쿠키에 설정 + // access 토큰을 쿠키에 설정 private setAccessTokenCookie(request: Request, accessToken: string): void { request.res?.cookie('accessToken', accessToken, { httpOnly: true,