From 5a14063bff9682cca1ab469afa23884c297a8c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=EC=98=81=EB=AF=BC?= Date: Wed, 24 Jul 2024 14:04:14 +0900 Subject: [PATCH] feat: change kakao auth code to access token --- .../main/java/kr/mafoo/user/controller/AuthController.java | 2 +- .../mafoo/user/controller/dto/request/KakaoLoginRequest.java | 4 ++-- .../src/main/java/kr/mafoo/user/service/AuthService.java | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/user-service/src/main/java/kr/mafoo/user/controller/AuthController.java b/user-service/src/main/java/kr/mafoo/user/controller/AuthController.java index b274df3..3c144a7 100644 --- a/user-service/src/main/java/kr/mafoo/user/controller/AuthController.java +++ b/user-service/src/main/java/kr/mafoo/user/controller/AuthController.java @@ -18,7 +18,7 @@ public class AuthController implements AuthApi { @Override public Mono loginWithKakao(KakaoLoginRequest request) { return authService - .loginWithKakao(request.code()) + .loginWithKakao(request.accessToken()) .map(authToken -> new LoginResponse(authToken.accessToken(), authToken.refreshToken())); } diff --git a/user-service/src/main/java/kr/mafoo/user/controller/dto/request/KakaoLoginRequest.java b/user-service/src/main/java/kr/mafoo/user/controller/dto/request/KakaoLoginRequest.java index e03d20b..bbed68d 100644 --- a/user-service/src/main/java/kr/mafoo/user/controller/dto/request/KakaoLoginRequest.java +++ b/user-service/src/main/java/kr/mafoo/user/controller/dto/request/KakaoLoginRequest.java @@ -4,7 +4,7 @@ @Schema(description = "카카오 로그인 요청") public record KakaoLoginRequest( - @Schema(description = "인가 코드", example = "test") - String code + @Schema(description = "카카오 엑세스 토큰", example = "test") + String accessToken ) { } diff --git a/user-service/src/main/java/kr/mafoo/user/service/AuthService.java b/user-service/src/main/java/kr/mafoo/user/service/AuthService.java index 4ace3f6..4efa510 100644 --- a/user-service/src/main/java/kr/mafoo/user/service/AuthService.java +++ b/user-service/src/main/java/kr/mafoo/user/service/AuthService.java @@ -41,9 +41,8 @@ public class AuthService { private final ObjectMapper objectMapper; - public Mono loginWithKakao(String code) { - return getKakaoTokenWithCode(code) - .flatMap(this::getUserInfoWithKakaoToken) + public Mono loginWithKakao(String kakaoAccessToken) { + return getUserInfoWithKakaoToken(kakaoAccessToken) .flatMap(kakaoLoginInfo -> getOrCreateMember( IdentityProvider.KAKAO, kakaoLoginInfo.id(),