diff --git a/src/main/java/org/prgrms/nabimarketbe/oauth2/kakao/api/OAuth2Controller.java b/src/main/java/org/prgrms/nabimarketbe/oauth2/kakao/api/OAuth2Controller.java index 58df02f3..8976e09b 100644 --- a/src/main/java/org/prgrms/nabimarketbe/oauth2/kakao/api/OAuth2Controller.java +++ b/src/main/java/org/prgrms/nabimarketbe/oauth2/kakao/api/OAuth2Controller.java @@ -8,6 +8,7 @@ import org.prgrms.nabimarketbe.domain.user.service.SignService; import org.prgrms.nabimarketbe.global.util.ResponseFactory; import org.prgrms.nabimarketbe.global.util.model.CommonResult; +import org.prgrms.nabimarketbe.global.util.model.SingleResult; import org.prgrms.nabimarketbe.oauth2.kakao.dto.KakaoProfile; import org.prgrms.nabimarketbe.oauth2.kakao.service.OAuth2Service; import org.springframework.core.env.Environment; @@ -39,11 +40,13 @@ public void socialLogin(HttpServletResponse response) throws IOException { } @GetMapping(value = "/redirect") - public UserLoginResponseDTO redirectKakao(@RequestParam String code) { + public ResponseEntity> redirectKakao(@RequestParam String code) { KakaoProfile profile = OAuth2Service.getResultProfile(code); if (profile == null) throw new RuntimeException("카카오에 해당 회원이 없습니다."); + UserLoginResponseDTO userLoginResponseDTO = signService.signInBySocial(profile); + SingleResult response = ResponseFactory.getSingleResult(userLoginResponseDTO); - return signService.signInBySocial(profile); + return ResponseEntity.ok(response); } //TODO : 사용자가 accessToken 넘기는건 아닌거 같음