diff --git a/src/main/java/PNUMEAT/Backend/global/security/oauth/OAuth2SuccessHandler.java b/src/main/java/PNUMEAT/Backend/global/security/oauth/OAuth2SuccessHandler.java index 803e82e..24e8d54 100644 --- a/src/main/java/PNUMEAT/Backend/global/security/oauth/OAuth2SuccessHandler.java +++ b/src/main/java/PNUMEAT/Backend/global/security/oauth/OAuth2SuccessHandler.java @@ -48,13 +48,12 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo Optional findRefreshToken = refreshTokenService.findRefreshToken(customUserDetails.getMember().getId()); - String refreshToken = null; + String refreshToken = jwtUtil.generateRefreshToken(uuid, role); if (findRefreshToken.isEmpty()) { - refreshToken = jwtUtil.generateRefreshToken(uuid, role); refreshTokenService.addRefreshEntity(refreshToken, uuid, jwtUtil.getRefreshExpiredTime()); } else { - refreshToken = findRefreshToken.get().getToken(); + refreshTokenService.renewalRefreshToken(findRefreshToken.get().getToken(), refreshToken, jwtUtil.getRefreshExpiredTime()); } String accessToken = jwtUtil.generateAccessToken(uuid, role);