diff --git a/server/src/main/java/haengdong/user/application/KakaoClient.java b/server/src/main/java/haengdong/user/application/KakaoClient.java index 6aa0757c..b6c5c7ab 100644 --- a/server/src/main/java/haengdong/user/application/KakaoClient.java +++ b/server/src/main/java/haengdong/user/application/KakaoClient.java @@ -1,6 +1,11 @@ package haengdong.user.application; +import haengdong.common.exception.HaengdongErrorCode; +import haengdong.common.exception.HaengdongException; +import haengdong.user.application.response.KakaoTokenResponse; +import haengdong.user.config.KakaoProperties; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -8,11 +13,8 @@ import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.RestClient; -import haengdong.user.application.response.KakaoTokenResponse; -import haengdong.user.config.KakaoProperties; -import haengdong.common.exception.HaengdongErrorCode; -import haengdong.common.exception.HaengdongException; +@Slf4j @RequiredArgsConstructor @EnableConfigurationProperties(KakaoProperties.class) @Component @@ -36,6 +38,7 @@ public KakaoTokenResponse join(String code, String redirectUri) { .retrieve() .body(KakaoTokenResponse.class); } catch (Exception e) { + log.info("로그인 실패 : {}", code); throw new HaengdongException(HaengdongErrorCode.KAKAO_LOGIN_FAIL, e); } } diff --git a/server/src/main/java/haengdong/user/application/KakaoUserService.java b/server/src/main/java/haengdong/user/application/KakaoUserService.java index 21c1919d..59f744c3 100644 --- a/server/src/main/java/haengdong/user/application/KakaoUserService.java +++ b/server/src/main/java/haengdong/user/application/KakaoUserService.java @@ -3,9 +3,11 @@ import com.auth0.jwt.JWT; import com.auth0.jwt.interfaces.DecodedJWT; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import haengdong.user.application.response.KakaoTokenResponse; +@Slf4j @RequiredArgsConstructor @Service public class KakaoUserService { @@ -23,6 +25,8 @@ public Long joinByKakao(String code, String redirectUri) { String memberNumber = decodedJWT.getSubject(); String nickname = decodedJWT.getClaim(NICKNAME_KEY).asString(); + log.info("로그인 성공 : {}, {}", code, nickname); + return userService.join(memberNumber, nickname); }