diff --git a/src/main/java/com/dearsanta/app/security/JwtInterceptor.java b/src/main/java/com/dearsanta/app/security/JwtInterceptor.java index bfae798..c18940e 100644 --- a/src/main/java/com/dearsanta/app/security/JwtInterceptor.java +++ b/src/main/java/com/dearsanta/app/security/JwtInterceptor.java @@ -22,7 +22,7 @@ public class JwtInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { - + log.info("JwtInterceptor - preHandle(): 로그인 시도"); String accessToken = request.getHeader("Authorization"); String memberId = getMemberIdByAccessToken(accessToken); diff --git a/src/main/java/com/dearsanta/app/security/KakaoOauthClient.java b/src/main/java/com/dearsanta/app/security/KakaoOauthClient.java index 41a4970..686cb1a 100644 --- a/src/main/java/com/dearsanta/app/security/KakaoOauthClient.java +++ b/src/main/java/com/dearsanta/app/security/KakaoOauthClient.java @@ -12,6 +12,8 @@ import org.springframework.stereotype.Service; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.HttpServerErrorException; import org.springframework.web.client.RestTemplate; import java.util.NoSuchElementException; @@ -60,7 +62,17 @@ private KakaoOauthTokenDto getKakaoAccessTokenByAuthorazationCode(String authori body.add("code", authorizeCode); HttpEntity request = new HttpEntity<>(body, headers); - return restTemplate.postForObject(TOKEN_URI, request, KakaoOauthTokenDto.class); + KakaoOauthTokenDto kakaoOauthTokenDto = null; + try { + kakaoOauthTokenDto = restTemplate.postForEntity(TOKEN_URI, request, KakaoOauthTokenDto.class).getBody(); + } catch(HttpClientErrorException e) { + log.error("HttpClientErrorException : " + e.getResponseBodyAsString()); + } catch(HttpServerErrorException e) { + log.error("HttpServerErrorException : " + e.getResponseBodyAsString()); + } catch(Exception e) { + log.error("Exception : " + e); + } + return kakaoOauthTokenDto; } // 2. 토큰으로 사용자 정보 조회하기