Skip to content

Commit

Permalink
[REFACTOR] 카카오 소셜 로그인 방식 JWT로 변경 (#215)
Browse files Browse the repository at this point in the history
refactor: 카카오 소셜 로그인에 JWT 방식 적용
  • Loading branch information
Profile-exe authored Nov 26, 2024
1 parent 3984833 commit 395da7f
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,16 @@ public ApiResponse<CustomBody<String>> logout(HttpServletRequest request) {

@Operation(summary = "카카오 소셜 로그인 (코드로 로그인)", description = "Redirect URL이 백엔드 주소로 설정될 때 사용합니다.")
@GetMapping("/login")
public ApiResponse<CustomBody<MemberResDto>> login(@RequestParam("code") String code, HttpServletRequest request) {
public ApiResponse<CustomBody<AuthToken>> 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이 프론트엔드 주소로 설정될 때 사용합니다.")
Expand Down

0 comments on commit 395da7f

Please sign in to comment.