Skip to content

Commit

Permalink
refactor : 소셜 로그인 response dto 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
seongjunnoh committed Aug 18, 2024
1 parent b3ba6f8 commit 5612a38
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import space.space_spring.dto.oAuth.KakaoInfo;
import space.space_spring.dto.oAuth.OAuthLoginResponse;
import space.space_spring.entity.User;
import space.space_spring.response.BaseResponse;
import space.space_spring.service.OAuthService;
Expand All @@ -35,7 +36,7 @@ public class OAuthController {
* 유저가 카카오 로그인 동의 시 호출될 콜백 함수
*/
@GetMapping("/callback/kakao")
public BaseResponse<Long> kakaoCallback(@RequestParam(name = "code") String code, HttpServletResponse response) {
public BaseResponse<OAuthLoginResponse> kakaoCallback(@RequestParam(name = "code") String code, HttpServletResponse response) {

// TODO 1. 인가코드 받기
// 카카오 인증 서버는 서비스 서버의 Redirect URI로 인가 코드를 전달함
Expand Down Expand Up @@ -70,6 +71,6 @@ public BaseResponse<Long> kakaoCallback(@RequestParam(name = "code") String code
response.setHeader("Authorization", "Bearer " + jwtOAuthLogin);
log.info("jwtOAuthLogin = {}", jwtOAuthLogin);

return new BaseResponse<>(userByOAuthInfo.getUserId());
return new BaseResponse<>(new OAuthLoginResponse(userByOAuthInfo.getUserId()));
}
}
13 changes: 13 additions & 0 deletions src/main/java/space/space_spring/dto/oAuth/OAuthLoginResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package space.space_spring.dto.oAuth;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class OAuthLoginResponse {

private Long userId;
}

0 comments on commit 5612a38

Please sign in to comment.