Skip to content

Commit f166c64

Browse files
committed
refactor: kakao access token 발급 요청에 대한 response dto에 필드 추가
1 parent f9f78db commit f166c64

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

src/main/java/com/ajou/hertz/common/kakao/dto/response/KakaoTokenResponse.java

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.ajou.hertz.common.kakao.dto.response;
22

3+
import org.springframework.lang.Nullable;
4+
35
import com.fasterxml.jackson.annotation.JsonProperty;
46

57
import lombok.AccessLevel;
@@ -18,6 +20,10 @@ public class KakaoTokenResponse {
1820
@JsonProperty("access_token")
1921
private String accessToken;
2022

23+
@JsonProperty("id_token")
24+
@Nullable
25+
private String idToken;
26+
2127
@JsonProperty("expires_in")
2228
private Integer expiresIn;
2329

@@ -26,4 +32,7 @@ public class KakaoTokenResponse {
2632

2733
@JsonProperty("refresh_token_expires_in")
2834
private Integer refreshTokenExpiresIn;
35+
36+
@Nullable
37+
private String scope;
2938
}

src/test/java/com/ajou/hertz/unit/common/kakao/service/KakaoServiceTest.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ private static KakaoLoginRequest createKakaoLoginRequest() throws Exception {
165165
}
166166

167167
private static KakaoTokenResponse createKakaoTokenResponse() throws Exception {
168-
return ReflectionUtils.createKakaoTokenResponse("bearer", "access-token", 43199, "refresh-token", 5184000);
168+
return ReflectionUtils.createKakaoTokenResponse(
169+
"bearer", "access-token", null, 43199, "refresh-token", 5184000, null
170+
);
169171
}
170172

171173
private static KakaoUserInfoResponse createKakaoUserInfoResponse() {

src/test/java/com/ajou/hertz/util/ReflectionUtils.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -906,16 +906,18 @@ public static VerifyUserAuthCodeRequest createVerifyUserAuthCodeRequest(
906906
public static KakaoTokenResponse createKakaoTokenResponse(
907907
String tokenType,
908908
String accessToken,
909+
@Nullable String idToken,
909910
Integer expiresIn,
910911
String refreshToken,
911-
Integer refreshTokenExpiresIn
912+
Integer refreshTokenExpiresIn,
913+
@Nullable String scope
912914
) throws Exception {
913915
Constructor<KakaoTokenResponse> constructor = KakaoTokenResponse.class.getDeclaredConstructor(
914-
String.class, String.class, Integer.class, String.class, Integer.class
916+
String.class, String.class, String.class, Integer.class, String.class, Integer.class, String.class
915917
);
916918
constructor.setAccessible(true);
917919
return constructor.newInstance(
918-
tokenType, accessToken, expiresIn, refreshToken, refreshTokenExpiresIn
920+
tokenType, accessToken, idToken, expiresIn, refreshToken, refreshTokenExpiresIn, scope
919921
);
920922
}
921923
}

0 commit comments

Comments
 (0)