Skip to content

Commit

Permalink
[Feat] 카카오 소셜로그인 수정 #1
Browse files Browse the repository at this point in the history
[Feat] 카카오 소셜로그인 수정 #1
  • Loading branch information
tokyj515 authored Jul 18, 2023
2 parents cf0b475 + a435356 commit 918c368
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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;
}

Expand Down
17 changes: 0 additions & 17 deletions src/main/java/com/example/neoul/service/AuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
*/



}

0 comments on commit 918c368

Please sign in to comment.