diff --git a/src/main/java/io/sobok/SobokSobok/auth/application/AuthService.java b/src/main/java/io/sobok/SobokSobok/auth/application/AuthService.java index 86b7ba8..ffe2bc3 100644 --- a/src/main/java/io/sobok/SobokSobok/auth/application/AuthService.java +++ b/src/main/java/io/sobok/SobokSobok/auth/application/AuthService.java @@ -6,16 +6,12 @@ import io.sobok.SobokSobok.auth.ui.dto.JwtTokenResponse; import io.sobok.SobokSobok.exception.ErrorCode; import io.sobok.SobokSobok.exception.model.NotFoundException; -import io.sobok.SobokSobok.friend.infrastructure.FriendQueryRepository; import io.sobok.SobokSobok.friend.infrastructure.FriendRepository; import io.sobok.SobokSobok.pill.domain.Pill; -import io.sobok.SobokSobok.pill.infrastructure.PillQueryRepository; import io.sobok.SobokSobok.pill.infrastructure.PillRepository; -import io.sobok.SobokSobok.pill.infrastructure.PillScheduleQueryRepository; import io.sobok.SobokSobok.pill.infrastructure.PillScheduleRepository; import io.sobok.SobokSobok.security.jwt.Jwt; import io.sobok.SobokSobok.security.jwt.JwtProvider; -import io.sobok.SobokSobok.sticker.infrastructure.LikeScheduleQueryRepository; import io.sobok.SobokSobok.sticker.infrastructure.LikeScheduleRepository; import lombok.RequiredArgsConstructor; import org.springframework.data.redis.core.RedisTemplate; @@ -56,8 +52,10 @@ public void logout(Long userId) { public JwtTokenResponse refresh(String token) { Authentication authentication = jwtProvider.getAuthentication(token); - String socialId = authentication.getName(); - + String username = authentication.getName(); + User user = userRepository.findByUsername(username) + .orElseThrow(() -> new NotFoundException(ErrorCode.UNREGISTERED_USER)); + String socialId = user.getSocialInfo().getSocialId(); if (socialId == null) { throw new NotFoundException(ErrorCode.UNREGISTERED_TOKEN); }