-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor #91 소셜 로그인 연동 기능 구현 #91
The head ref may contain hidden characters: "refactor/#88/\uC18C\uC15C-\uB85C\uADF8\uC778-\uC218\uC815"
Conversation
# Conflicts: # src/main/java/leets/weeth/domain/user/application/usecase/UserUseCase.java # src/main/java/leets/weeth/domain/user/application/usecase/UserUseCaseImpl.java
@Override | ||
@Transactional | ||
public SocialLoginResponse integrate(NormalLogin dto) { | ||
User user = userGetService.find(dto.email()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 되면 카카오 계정 이메일이랑 일반 이메일이 일치하지 않는 경우도 있나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어떤 부분에서 불일치를 말씀하시는 걸까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아! 이메일이 일치하는 경우만 통합되네요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전화번호나 학번을 이용해서 통합하는건 어려울까요? 현재 사용하는 이메일과 카카오 이메일이 다른 경우도 있을 수 있다 생각해요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
연동은 kakaoId를 통해서 연동합니다!
여기서 입력 받는 이메일은 사용자 인증을 위해 ID/비번을 받는 부분이라서 연동에 직접적으로 사용되진 않습니다
사용자 인증이 완료되면 null인 kakaoId 컬럼에 데이터가 삽입돼서 연동이 되는 방식입니당
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다 !
이메일과 관련해서는 소셜 로그인의 장점이 간편한 회원가입 + 로그인이라 초기 정보입력시 필드를 최소화 하는 것이 좋아보이기도 하고, 저희 서비스단에서 중복 가입은 허용이 안되도록 해놓아서 이메일을 따로 입력받지 않아도 될거같다는 개인적인 생각이있습니다.
해당 부분 관련해서는 프론트분들의 의견을 들어봐도 좋을거같습니다
return userRepository.findByKakaoId(kakaoId) | ||
.orElse(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 kakaoId로 유저를 조회할 때, 값이 없으면 예외처리를 하지않고 null을 반환하는 것이 카카오 ID가 없는 것이 예외상황이 아닌 정상적인 상황으로 간주하고 mapper.toIntegrateResponse(kakaoId)를 이용하신 로직으로 이해했습니다
해당 메서드에 null을 반환하는 대신에 Optional을 사용해주는 방식은 어떨까요 ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional로 반환해주는 것이 값의 여부를 구분하기에 더 명시적일 거 같아요
수정하겠습니다!
return CommonResponse.createSuccess(USER_APPLY_SUCCESS.getMessage()); | ||
} | ||
|
||
@PatchMapping("/integrate") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 엔드포인트도좋지만 동사보다는 명사의 형태로 설계하는 것이 지향된다고 알고있어,
social-link나 kakao-link와 같은 형태로 개선하면 더 RESTful한 설계가 될거같은데 어떻게 생각하실까요 ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 그렇네요 좀 더 좋은 엔드포인트로 고민해보겠습니닷
@Override | ||
@Transactional | ||
public SocialLoginResponse integrate(NormalLogin dto) { | ||
User user = userGetService.find(dto.email()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아! 이메일이 일치하는 경우만 통합되네요
@Override | ||
@Transactional | ||
public SocialLoginResponse integrate(NormalLogin dto) { | ||
User user = userGetService.find(dto.email()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전화번호나 학번을 이용해서 통합하는건 어려울까요? 현재 사용하는 이메일과 카카오 이메일이 다른 경우도 있을 수 있다 생각해요
) { | ||
} | ||
|
||
public record Register( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SignUp과 Register 이름이 헷갈릴거같은데 kakao를 앞에 추가하는건 어떤가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
socialRegister로 수정하겠습니당
고생하셨어요 문제 없어보입니다 ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨어요! 연동할땐 카카오 로그인과 기존 로그인을 같이 받는거였네요
PR 내용
PR 세부사항
카카오 소셜 로그인 연동을 위해 social-login , social-register, social-auth 메서드를 사용했습니다
로그인은 login/integrate로 사용되고, auth는 소셜 회원가입시 kakaoId를 프론트 측으로 전달하기 위한 api 입니다
자세한 플로우는 아래와 같습니다
소셜 회원가입
소셜 로그인
연동 전
연동 후, 소셜 회원가입 후
관련 스크린샷
주의사항
체크 리스트