From 4b4eff0ccf77c99082dfe3fc98a60562dfbbd264 Mon Sep 17 00:00:00 2001 From: KNU-K Date: Tue, 26 Nov 2024 05:59:19 +0900 Subject: [PATCH] refactor(auth): add token rotation feature --- src/modules/auth/application/service/auth.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/auth/application/service/auth.service.ts b/src/modules/auth/application/service/auth.service.ts index c1679dd..57537e8 100644 --- a/src/modules/auth/application/service/auth.service.ts +++ b/src/modules/auth/application/service/auth.service.ts @@ -41,7 +41,9 @@ export class AuthService { return await this.issueToken(payload, this.accessJwtSignOptions); } private async issueRefreshToken(payload) { - return await this.issueToken(payload, this.refreshJwtSignOptions); + const refreshToken = await this.issueToken(payload, this.refreshJwtSignOptions); + await this.redisService.set(payload.sub, refreshToken); + return refreshToken; } private async issueToken(payload, options) { return await this.jwtService.signAsync(payload, options);