From 395da7fd6775d60dfaeadb60df77238b2451f52d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=AA=85=EB=8D=95?= <68066437+Profile-exe@users.noreply.github.com> Date: Tue, 26 Nov 2024 18:01:24 +0900 Subject: [PATCH] =?UTF-8?q?[REFACTOR]=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=EC=86=8C=EC=85=9C=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=20JWT=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20(#215)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor: 카카오 소셜 로그인에 JWT 방식 적용 --- .../buddybridge/auth/controller/OAuthController.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/econo/buddybridge/auth/controller/OAuthController.java b/src/main/java/econo/buddybridge/auth/controller/OAuthController.java index b03305e..cceb9a4 100644 --- a/src/main/java/econo/buddybridge/auth/controller/OAuthController.java +++ b/src/main/java/econo/buddybridge/auth/controller/OAuthController.java @@ -57,19 +57,16 @@ public ApiResponse> logout(HttpServletRequest request) { @Operation(summary = "카카오 소셜 로그인 (코드로 로그인)", description = "Redirect URL이 백엔드 주소로 설정될 때 사용합니다.") @GetMapping("/login") - public ApiResponse> login(@RequestParam("code") String code, HttpServletRequest request) { + public ApiResponse> login(@RequestParam("code") String code) { KakaoLoginParams params = new KakaoLoginParams(code); - MemberResDto memberDto = oAuthLoginService.login(params); - - HttpSession session = request.getSession(true); - session.setAttribute("memberId", memberDto.memberId()); + AuthToken authToken = oAuthLoginService.loginWithToken(params); // 프론트엔드 주소로 redirect HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.setLocation(URI.create(frontUrl)); - return ApiResponseGenerator.success(memberDto, httpHeaders, HttpStatus.PERMANENT_REDIRECT); + return ApiResponseGenerator.success(authToken, httpHeaders, HttpStatus.PERMANENT_REDIRECT); } @Operation(summary = "카카오 소셜 로그인 (토큰으로 로그인)", description = "Redirect URL이 프론트엔드 주소로 설정될 때 사용합니다.")