Skip to content

Commit

Permalink
feat - #24 애플 feign client 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
kseysh committed Jan 9, 2024
1 parent c982333 commit 736f159
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
public enum SocialPlatform {

KAKAO("kakao"),
APPLE("apple")
;

private final String value;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package sopt.org.HMH.global.auth.social.apple.fegin;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;

@FeignClient(name = "appleFeignClient", url = "${oauth2.apple.base-url}")
public interface AppleFeignClient {
@GetMapping("/auth/keys")

This comment has been minimized.

Copy link
@jumining

jumining Jan 10, 2024

Collaborator

P3. Kakao Interface에서 처럼 빈 줄로 띄워두면 좋을 것 같아요!

ApplePublicKeys getApplePublicKeys();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sopt.org.HMH.global.auth.social.kakao.request.KakaoUserRequest;

@FeignClient(name = "kakaoApiClient", url = "${oauth2.kakao.base-url}")
public interface KakaoApiClient {
public interface KakaoFeignClient {

@GetMapping(value = "/v2/user/me")
KakaoUserRequest getUserInformation(@RequestHeader(HttpHeaders.AUTHORIZATION) String accessToken);

This comment has been minimized.

Copy link
@jumining

jumining Jan 10, 2024

Collaborator

P3. 파라미터에 final 추가합시당!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
@RequiredArgsConstructor
public class KakaoLoginService {

private final KakaoApiClient kakaoApiClient;
private final KakaoFeignClient kakaoFeignClient;

/**
* 카카오 Acess Token으로 유저의 소셜 Id 불러오는 함수
*/
public Long getSocialIdByKakao(String socialAccessToken) {

KakaoUserRequest userResponse = kakaoApiClient.getUserInformation(socialAccessToken);
KakaoUserRequest userResponse = kakaoFeignClient.getUserInformation(socialAccessToken);
System.out.println("userResponse : " + userResponse);

This comment has been minimized.

Copy link
@jumining

jumining Jan 10, 2024

Collaborator

P3. 혹시 배포 이후에도 필요한 프린트문일까요??

return userResponse.id();
}
Expand All @@ -28,7 +28,7 @@ public Long getSocialIdByKakao(String socialAccessToken) {
* 카카오 Access Token으로 유저 정보 업데이트
*/
public void updateUserInfoByKakao(User loginUser, String socialAccessToken) {

This comment has been minimized.

Copy link
@jumining

jumining Jan 10, 2024

Collaborator

P3. final 추가 부탁드립네당

KakaoUserRequest userResponse = kakaoApiClient.getUserInformation(socialAccessToken);
KakaoUserRequest userResponse = kakaoFeignClient.getUserInformation(socialAccessToken);

String nickname = userResponse.kakaoAccount().profile().nickname();
String profileImageUrl = userResponse.kakaoAccount().profile().profileImageUrl();
Expand Down

0 comments on commit 736f159

Please sign in to comment.