From 2c39e01d0235d84989f720ed1820c1d1b593118f Mon Sep 17 00:00:00 2001 From: UU_jeong <80961726+oU-Ua@users.noreply.github.com> Date: Mon, 22 Jan 2024 19:43:40 +0900 Subject: [PATCH] feat : kakaoLogin --- .../promiseme/users/controller/UserController.java | 14 +++++++------- .../mvc/promiseme/users/dto/KakaoResponseDTO.java | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 src/main/java/mvc/promiseme/users/dto/KakaoResponseDTO.java diff --git a/src/main/java/mvc/promiseme/users/controller/UserController.java b/src/main/java/mvc/promiseme/users/controller/UserController.java index f1a00b3..6835beb 100644 --- a/src/main/java/mvc/promiseme/users/controller/UserController.java +++ b/src/main/java/mvc/promiseme/users/controller/UserController.java @@ -13,6 +13,7 @@ import mvc.promiseme.common.exception.ErrorResponse; import mvc.promiseme.kakao.KakaoApi; import mvc.promiseme.project.dto.ProjectResponseDTO; +import mvc.promiseme.users.dto.KakaoResponseDTO; import mvc.promiseme.users.dto.LoginRequestDTO; import mvc.promiseme.users.dto.LoginResponseDTO; import mvc.promiseme.users.dto.UserDTO; @@ -63,14 +64,13 @@ public class UserController { @Operation(summary = "카카오로그인", description = "카카오 로그인 창으로 이동 ") @ApiResponses({ - @ApiResponse(responseCode = "200", description = "성공", content = @Content(schema = @Schema(implementation = Map.class))), + @ApiResponse(responseCode = "200", description = "성공", content = @Content(schema = @Schema(implementation = Map.class))) }) - @GetMapping("user/loginKakao") - public ResponseEntity> kakaoLogin(){ - Map map = new HashMap<>(); - map.put("kakaoApiKey", kakaoApi.getKakaoApiKey()); - map.put("redirectUri", kakaoApi.getKakaoRedirectUri()); - return ResponseEntity.ok(map); + @PostMapping("user/loginKakao") + public ResponseEntity kakaoLogin(){ + KakaoResponseDTO kakaoResponseDTO = new KakaoResponseDTO(kakaoApi.getKakaoApiKey(),kakaoApi.getKakaoRedirectUri()); + + return ResponseEntity.ok(kakaoResponseDTO); } @GetMapping("/login/oauth/kakao") diff --git a/src/main/java/mvc/promiseme/users/dto/KakaoResponseDTO.java b/src/main/java/mvc/promiseme/users/dto/KakaoResponseDTO.java new file mode 100644 index 0000000..174cb8d --- /dev/null +++ b/src/main/java/mvc/promiseme/users/dto/KakaoResponseDTO.java @@ -0,0 +1,14 @@ +package mvc.promiseme.users.dto; + +import lombok.*; + +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +@Builder +public class KakaoResponseDTO { + private String kakaoApiKey; + private String redirectUri; +// private String token; +}