Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: 애플 로그인 수정 #168

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Object> 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 객체 생성 후 반환
Expand Down
Loading