Skip to content

Commit

Permalink
Fix : 머지할때 잘못된 부분 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
mmihye committed May 28, 2024
1 parent 255265d commit 3ca26b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,22 @@ public LoginRes signIn(String token, String type) {

if(type == "KAKAO") {
//Business Logic
// 카카오로 액세스 토큰 요청하기
KakaoToken kakaoAccessToken = kakaoClient.getKakaoAccessToken(token);
// 카카오톡에 있는 사용자 정보 반환
KakaoProfile kakaoProfile = kakaoClient.getMemberInfo(kakaoAccessToken);
KakaoProfile kakaoProfile = kakaoClient.getMemberInfo(token);
// 반환된 정보의 이메일 기반으로 사용자 테이블에서 계정 정보 조회 진행
member = memberRepository.findMemberByEmailAndDeletedAtIsNull(kakaoProfile.kakao_account().email()).orElse(null);
// 이메일 존재 시 로그인 , 존재하지 않을 경우 회원가입 진행
if (member == null) {
if(member == null) {
Member newMember = Member.builder()
.email(kakaoProfile.kakao_account().email())
.name(kakaoProfile.kakao_account().profile().nickname())
.memberType(MemberType.GENERAL)
.loginType(LoginType.KAKAO)
.profileUrl(kakaoProfile.kakao_account().profile().profile_image_url())
.memberType(MemberType.valueOf("GENERAL"))
.loginType(LoginType.valueOf("KAKAO"))
.build();

member = memberRepository.save(newMember);
}
tokenDto = tokenProvider.createToken(member);

// RefreshToken 저장
member.setRefreshToken(tokenDto.refreshToken());

// Response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ public KakaoToken getKakaoAccessToken(String code) {
return kakaoToken;
}

public KakaoProfile getMemberInfo(KakaoToken kakaoToken) {
public KakaoProfile getMemberInfo(String accesToken) {
// 요청 기본 객체 생성
WebClient webClient = WebClient.create(kakaoUserInfoUri);

// 요청 보내서 응답 받기
String response = webClient.post()
.uri(kakaoUserInfoUri)
.header("Content-Type", "application/x-www-form-urlencoded;charset=utf-8")
.header("Authorization", "Bearer " + kakaoToken.access_token())
.header("Authorization", accesToken)
.retrieve()
.bodyToMono(String.class)
.block();
Expand Down

0 comments on commit 3ca26b6

Please sign in to comment.