Skip to content

Commit

Permalink
fix(#212): refresh token 삭제 로직 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
tnpfldyd committed Dec 12, 2023
1 parent 2a45b11 commit d951825
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nestjs-BE/server/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ export class AuthService extends BaseService<TokenData> {
}

async renewAccessToken(refreshToken: string) {
const decodedToken = this.jwtService.decode(refreshToken);
const uuid = decodedToken?.uuid;
try {
const { uuid } = this.jwtService.verify(refreshToken, {
this.jwtService.verify(refreshToken, {
secret: jwtConstants.refreshSecret,
});
const { data: tokenData } = await super.findOne(uuid);
Expand All @@ -116,7 +118,7 @@ export class AuthService extends BaseService<TokenData> {
access_token: accessToken,
});
} catch (error) {
super.remove(refreshToken);
super.remove(uuid);
throw new UnauthorizedException(
'Refresh token expired. Please log in again.',
);
Expand Down

0 comments on commit d951825

Please sign in to comment.