From a43535646361a4604751d5ef51050978bae4ab73 Mon Sep 17 00:00:00 2001 From: YuJin Kwon Date: Tue, 18 Jul 2023 17:44:52 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=EC=86=8C=EC=85=9C=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20#1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../neoul/controller/AuthController.java | 5 +++-- .../com/example/neoul/service/AuthService.java | 17 ----------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/example/neoul/controller/AuthController.java b/src/main/java/com/example/neoul/controller/AuthController.java index f078993..ed59559 100644 --- a/src/main/java/com/example/neoul/controller/AuthController.java +++ b/src/main/java/com/example/neoul/controller/AuthController.java @@ -3,6 +3,7 @@ import com.example.neoul.dto.TokenRes; import com.example.neoul.dto.UserReq; import com.example.neoul.global.entity.BaseEntity; +import com.example.neoul.global.exception.BadRequestException; import com.example.neoul.service.AuthService; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -23,7 +24,7 @@ public class AuthController { @ApiOperation(value = "인가코드 캐치를 위한 api, 사용x, 백엔드 터미널로 반환중", notes = "원래는 프론트엔드가 첫 회원가입 링크로 들어가서 code를 받고, 그 받은 코드로 이 api에 접근해서" + "카카오의 access_token을 반환 후" + - "access_token을 아래의 api에 넣어서 우리 사이트의 로그인하고 그 결과를 얻음") + "access_token을 /kakao/login의 요청에 넣어서 우리 사이트의 로그인하고 그 결과를 얻음") @GetMapping("/kakao") public String getAccessTokenKakao(@RequestParam String code) { String accessToken=authService.getKakaoAccessToken(code); @@ -39,7 +40,7 @@ public TokenRes kakaoSignupOrLogin(@RequestBody UserReq.SocialReq socialReq) { TokenRes tokenRes = authService.createAndLoginKakaoUser(socialReq); if(tokenRes == null) - return null; + throw new BadRequestException("사용자 정보가 없습니다"); return tokenRes; } diff --git a/src/main/java/com/example/neoul/service/AuthService.java b/src/main/java/com/example/neoul/service/AuthService.java index 496812f..e68da48 100644 --- a/src/main/java/com/example/neoul/service/AuthService.java +++ b/src/main/java/com/example/neoul/service/AuthService.java @@ -158,23 +158,6 @@ public TokenRes createAndLoginKakaoUser(UserReq.SocialReq socialReq) { return null; } - /* - //회원가입과 로그인 분리 - public TokenRes loginKakaoUser(UserReq.SocialLoginUserReq socialLoginUserReq) { - if(userRepository.existsByUsernameAndSocial(socialLoginUserReq.getUsername(), socialLoginUserReq.getSocial())){ - User user = userRepository.findByUsernameAndSocial(socialLoginUserReq.getUsername(), socialLoginUserReq.getSocial()); - - GenerateToken generateToken = tokenProvider.createAllToken(user.getIdx()); - - return new TokenRes(user.getUsername(), generateToken.getAccessToken(), generateToken.getRefreshToken()); - - } - - return null; - } - - */ - }