From c747d1a4f6b405e68011170b7a13a302aa46c5e3 Mon Sep 17 00:00:00 2001 From: niamu01 Date: Tue, 16 Jul 2024 23:16:13 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20:bug:=20token=EC=9D=98=20=EB=A7=8C?= =?UTF-8?q?=EB=A3=8C=EC=8B=9C=EA=B0=84=20=EA=B0=80=EC=A0=B8=EC=98=A4?= =?UTF-8?q?=EB=8A=94=20=EB=B6=80=20=EB=B6=84=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/auth/auth.controller.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index 7e58ee8..bc2b1d4 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -141,6 +141,8 @@ export class Auth42Controller { const jwtSecret = this.configService.getOrThrow('jwt.secret'); + this.logger.debug(`@refreshToken) refreshToken : ${refreshToken}`); + try { const payload = await this.jwtService.verifyAsync(refreshToken); @@ -149,8 +151,11 @@ export class Auth42Controller { { expiresIn: accessExpiresIn, secret: jwtSecret }, ); + const decodedAccessTokenForExpires = + await this.jwtService.verifyAsync(newAccessToken); + const accessTokenExpires = new Date( - (await this.jwtService.verifyAsync(newAccessToken)['exp']) * 1000, + decodedAccessTokenForExpires['exp'] * 1000, ); res.cookie('accessToken', newAccessToken, {