Skip to content

Commit

Permalink
[fix] 1. 로그인 SocailLogin 함수 반환값 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryeolee committed Mar 23, 2024
1 parent 748d0eb commit c1ba121
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,18 @@ public class AuthService {

public BaseResponseDto<LoginResponseDto> googleLogin(String googleAccessToken) {

return googleLogin.loginMethod(googleAccessToken);
return BaseResponseDto.of(SuccessCode.SUCCESS,
googleLogin.loginMethod(googleAccessToken)

);
}

public BaseResponseDto<LoginResponseDto> kakaoLogin(String kakaoAccessToken) {

return kakaoLogin.loginMethod(kakaoAccessToken);
return BaseResponseDto.of(SuccessCode.SUCCESS,
kakaoLogin.loginMethod(kakaoAccessToken)
);


}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.modernfarmer.farmusspring.domain.auth.util.social;

import com.modernfarmer.farmusspring.domain.auth.dto.LoginResponseDto;
import com.modernfarmer.farmusspring.domain.auth.repository.RedisManager;
import com.modernfarmer.farmusspring.domain.auth.util.social.dto.GoogleUserResponseDto;
import com.modernfarmer.farmusspring.domain.auth.util.social.dto.KakaoUserResponseDto;
import com.modernfarmer.farmusspring.domain.user.repository.UserRepository;
import com.modernfarmer.farmusspring.global.common.security.JwtTokenProvider;
import com.modernfarmer.farmusspring.global.response.BaseResponseDto;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.client.WebClient;

Expand All @@ -18,7 +17,7 @@ public GoogleLogin(WebClient webClient, JwtTokenProvider jwtTokenProvider, Redis
}

@Override
public BaseResponseDto loginMethod(String socialToken) {
public LoginResponseDto loginMethod(String socialToken) {
GoogleUserResponseDto socialUserData = getUserData(
socialToken,
"https://www.googleapis.com/oauth2/v2/userinfo",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.modernfarmer.farmusspring.domain.auth.util.social;


import com.modernfarmer.farmusspring.domain.auth.dto.LoginResponseDto;
import com.modernfarmer.farmusspring.domain.auth.repository.RedisManager;
import com.modernfarmer.farmusspring.domain.auth.util.social.dto.KakaoUserResponseDto;
import com.modernfarmer.farmusspring.domain.user.repository.UserRepository;
Expand All @@ -17,7 +18,7 @@ public KakaoLogin(WebClient webClient, JwtTokenProvider jwtTokenProvider, RedisM
}

@Override
public BaseResponseDto loginMethod(String socialToken) {
public LoginResponseDto loginMethod(String socialToken) {
KakaoUserResponseDto socialUserData = getUserData(
socialToken,
"https://kapi.kakao.com/v2/user/me",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ abstract public class SocialLogin {
private final UserRepository userRepository;


public abstract BaseResponseDto<LoginResponseDto> loginMethod(String socialToken);
public abstract LoginResponseDto loginMethod(String socialToken);

public BaseResponseDto login( SocialUserResponseDto socialUserData2){
public LoginResponseDto login( SocialUserResponseDto socialUserData2){

verifySocialUserData(socialUserData2);

Expand All @@ -50,13 +50,10 @@ public BaseResponseDto login( SocialUserResponseDto socialUserData2){

redisManager.setValueByKey(String.valueOf(userLoginData.get().getId()), refreshToken);

return BaseResponseDto.of(
SuccessCode.SUCCESS,
LoginResponseDto.of(
return LoginResponseDto.of(
accessToken,
refreshToken,
userLoginData.get().isEarly()
)
);
}

Expand Down

0 comments on commit c1ba121

Please sign in to comment.