From e7d392c4b432eba18d48d5e44785020a4244287a Mon Sep 17 00:00:00 2001 From: khee2 <21keunghee@gmail.com> Date: Thu, 1 Aug 2024 01:49:30 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=9A=94=EC=B2=AD=20dto=EB=A1=9C?= =?UTF-8?q?=20=EC=9D=B8=EA=B0=80=EC=BD=94=EB=93=9C=20=EB=B0=9B=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/api/KakaoAuthController.java | 7 ++++--- .../domain/member/dto/KakaoLoginRequestDto.java | 8 ++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/solucitation/midpoint_backend/domain/member/dto/KakaoLoginRequestDto.java diff --git a/src/main/java/com/solucitation/midpoint_backend/domain/member/api/KakaoAuthController.java b/src/main/java/com/solucitation/midpoint_backend/domain/member/api/KakaoAuthController.java index ed50c25..1d512a8 100644 --- a/src/main/java/com/solucitation/midpoint_backend/domain/member/api/KakaoAuthController.java +++ b/src/main/java/com/solucitation/midpoint_backend/domain/member/api/KakaoAuthController.java @@ -1,4 +1,5 @@ package com.solucitation.midpoint_backend.domain.member.api; +import com.solucitation.midpoint_backend.domain.member.dto.KakaoLoginRequestDto; import com.solucitation.midpoint_backend.domain.member.dto.TokenResponseDto; import com.solucitation.midpoint_backend.domain.member.service.OAuth2KakaoService; import lombok.RequiredArgsConstructor; @@ -37,12 +38,12 @@ public ResponseEntity> getKakaoConfig() { * 백엔드에서 카카오 액세스 토큰을 요청하고, 사용자 정보를 가져와서 회원으로 등록하거나 인증을 수행합니다. * 그 후, 자체 JWT 액세스 토큰과 리프레시 토큰을 생성하여 응답합니다. (기존 로그인과 동일) * - * @param requestBody 인가 코드를 포함한 요청 본문 + * @param kakaoLoginRequestDto 인가 코드를 포함한 요청 본문 * @return 성공 시 JWT 액세스 토큰과 리프레시 토큰을 포함한 응답 */ @PostMapping("/oauth2/code/kakao") - public ResponseEntity oauth2KakaoCallback(@RequestBody Map requestBody) { - String code = requestBody.get("code"); + public ResponseEntity oauth2KakaoCallback(@RequestBody KakaoLoginRequestDto kakaoLoginRequestDto) { + String code = kakaoLoginRequestDto.getCode(); TokenResponseDto tokenResponse = oAuth2KakaoService.registerOrAuthenticateKakaoUser(code); return ResponseEntity.ok(tokenResponse); } diff --git a/src/main/java/com/solucitation/midpoint_backend/domain/member/dto/KakaoLoginRequestDto.java b/src/main/java/com/solucitation/midpoint_backend/domain/member/dto/KakaoLoginRequestDto.java new file mode 100644 index 0000000..150c083 --- /dev/null +++ b/src/main/java/com/solucitation/midpoint_backend/domain/member/dto/KakaoLoginRequestDto.java @@ -0,0 +1,8 @@ +package com.solucitation.midpoint_backend.domain.member.dto; + +import lombok.Getter; + +@Getter +public class KakaoLoginRequestDto { + private String code; +}