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] client Id 수정 및 OauthService 로직 개선 #158 #159

Merged
merged 1 commit into from
Apr 16, 2024
Merged
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 @@ -88,19 +88,24 @@ public LoginResult login(OauthTokenCommand tokenRequest) {
OAuthPlatformMemberResult applePlatformMember = appleLoginService.getApplePlatformMember(tokenRequest.accessToken());

List<User> userEntity = userRetriever.getUsersBySocialId(applePlatformMember.platformId());
log.info("userEntity: {}", userEntity.size());

User user;
//처음 로그인 하거나 탈퇴한 경우 -> 회원가입
if (userEntity == null || isWithdrawn(userEntity)) {
User user = saveUser(null, applePlatformMember.platformId(), socialPlatform, tokenRequest, refreshToken);
if (userEntity.isEmpty() || isWithdrawn(userEntity)) {
user = saveUser(null, applePlatformMember.platformId(), socialPlatform, tokenRequest, refreshToken);
}
userEntity = userRetriever.getUsersBySocialId(applePlatformMember.platformId());
user = userEntity.get(0);

//로그인
updateRefreshToken(user, refreshToken);
String accessToken = jwtTokenProvider.createAccessToken(new UserAuthentication(user.getId(),null,null));
//로그인
updateRefreshToken(user, refreshToken);
String accessToken = jwtTokenProvider.createAccessToken(new UserAuthentication(user.getId(),null,null));

boolean isFinishedOnboarding = healthRetriever.existsHealthByUser(user);
boolean isMatched = user.getParentchild() != null && user.getParentchild().isMatched();
boolean isFinishedOnboarding = healthRetriever.existsHealthByUser(user);
boolean isMatched = user.getParentchild() != null && user.getParentchild().isMatched();

return LoginResult.of(user, accessToken, refreshToken, isFinishedOnboarding, isMatched);
}
return LoginResult.of(user, accessToken, refreshToken, isFinishedOnboarding, isMatched);
}
throw new UserException(INVALID_SOCIAL_PLATFORM);
}
Expand Down
Loading