From ad7695b35a2348f13d1443ccd5ffaf6d39e80418 Mon Sep 17 00:00:00 2001 From: 1223v <1223v@naver.com> Date: Tue, 27 Feb 2024 18:00:49 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=95=A0=ED=94=8C=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=9D=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/readyvery/readyverydemo/config/OauthConfig.java | 1 - .../security/oauth2/service/CustomOAuth2UserService.java | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/readyvery/readyverydemo/config/OauthConfig.java b/src/main/java/com/readyvery/readyverydemo/config/OauthConfig.java index ac6e4fe..eadb3ca 100644 --- a/src/main/java/com/readyvery/readyverydemo/config/OauthConfig.java +++ b/src/main/java/com/readyvery/readyverydemo/config/OauthConfig.java @@ -9,5 +9,4 @@ public class OauthConfig { public static final String KAKAO_NAME = "kakao"; public static final String APPLE_NAME = "apple"; - public static final String GOOGLE_NAME = "google"; } diff --git a/src/main/java/com/readyvery/readyverydemo/security/oauth2/service/CustomOAuth2UserService.java b/src/main/java/com/readyvery/readyverydemo/security/oauth2/service/CustomOAuth2UserService.java index 9f8c70d..5da7147 100644 --- a/src/main/java/com/readyvery/readyverydemo/security/oauth2/service/CustomOAuth2UserService.java +++ b/src/main/java/com/readyvery/readyverydemo/security/oauth2/service/CustomOAuth2UserService.java @@ -48,12 +48,13 @@ public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2Authentic */ String registrationId = userRequest.getClientRegistration().getRegistrationId(); SocialType socialType = getSocialType(registrationId); + System.out.println("socialType = " + socialType); String userNameAttributeName = userRequest.getClientRegistration() .getProviderDetails().getUserInfoEndpoint().getUserNameAttributeName(); // OAuth2 로그인 시 키(PK)가 되는 값 Map attributes = oAuth2User.getAttributes(); // 소셜 로그인에서 API가 제공하는 userInfo의 Json 값(유저 정보들) // socialType에 따라 유저 정보를 통해 OAuthAttributes 객체 생성 - System.out.println("attributes = " + attributes); + OAuthAttributes extractAttributes = OAuthAttributes.of(socialType, userNameAttributeName, attributes); UserInfo createdUser = getUser(extractAttributes, socialType); // getUser() 메소드로 User 객체 생성 후 반환