From 54f96c231b059922fe76a2a421586a9a55fd92e1 Mon Sep 17 00:00:00 2001 From: larama-C Date: Tue, 16 Dec 2025 12:30:50 +0900 Subject: [PATCH 1/7] =?UTF-8?q?refactor:=20CORS=20=EC=84=A4=EC=A0=95=20(?= =?UTF-8?q?=EB=A1=9C=EC=BB=AC=20<>=20=EB=B0=B0=ED=8F=AC=20=EC=84=9C?= =?UTF-8?q?=EB=B2=84=EA=B0=84=20=ED=85=8C=EC=8A=A4=ED=8A=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web7_9_codecrete_be/global/security/SecurityConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/back/web7_9_codecrete_be/global/security/SecurityConfig.java b/src/main/java/com/back/web7_9_codecrete_be/global/security/SecurityConfig.java index be26824b..499a88da 100644 --- a/src/main/java/com/back/web7_9_codecrete_be/global/security/SecurityConfig.java +++ b/src/main/java/com/back/web7_9_codecrete_be/global/security/SecurityConfig.java @@ -83,7 +83,7 @@ public AuthenticationManager authenticationManager(AuthenticationConfiguration c public UrlBasedCorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration =new CorsConfiguration(); - configuration.setAllowedOrigins(List.of("http://localhost:3000")); + configuration.setAllowedOrigins(List.of("http://localhost:3000","https://web-6-7-codecrete-fe.vercel.app", "https://www.naeconcertbutakhae.shop")); configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")); configuration.setAllowedHeaders(List.of("*")); From e6e3022b521fc19b67d9cc14cc0ba155b2a1a7ca Mon Sep 17 00:00:00 2001 From: larama-C Date: Tue, 16 Dec 2025 16:21:12 +0900 Subject: [PATCH 2/7] =?UTF-8?q?feat:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=EC=86=8C=EC=85=9C=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=B6=94=EA=B0=80(=EA=B0=9C=EB=B0=9C=20=ED=99=98?= =?UTF-8?q?=EA=B2=BD=EC=97=90=EC=84=9C=EB=8A=94=20dev)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-dev.yml | 8 +++++++- src/main/resources/application.yml | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 6de946d0..329002f0 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -7,4 +7,10 @@ spring: url: jdbc:h2:./db_dev;MODE=MySQL username: sa password: - driver-class-name: org.h2.Driver \ No newline at end of file + driver-class-name: org.h2.Driver + +oauth: + kakao: + client-id: ${KAKAO_REST_API_KEY} # 카카오 REST API 키 + client-secret: ${KAKAO_CLIENT_SECRET} # 카카오 Client Secret + redirect-uri: http://localhost:3000/oauth/kakao # 카카오 로그인 Redirect URI \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index af1db18b..74a888c1 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -47,4 +47,10 @@ kopis: api-key: ${KOPIST_API_KEY} spotify: client-id: ${SPOTIFY_CLIENT_ID} - client-secret: ${SPOTIFY_CLIENT_SECRET} \ No newline at end of file + client-secret: ${SPOTIFY_CLIENT_SECRET} + +oauth: + kakao: + client-id: ${KAKAO_REST_API_KEY} # 카카오 REST API 키 + client-secret: ${KAKAO_CLIENT_SECRET} # 카카오 Client Secret + redirect-uri: ${KAKAO_REDIRECT_URI} # 카카오 로그인 Redirect URI From 500344523fbfac9fd236a4dcf5cce646bceff7be Mon Sep 17 00:00:00 2001 From: larama-C Date: Tue, 16 Dec 2025 16:22:11 +0900 Subject: [PATCH 3/7] =?UTF-8?q?refactor:=20=EC=86=8C=EC=85=9C=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=EC=9C=BC=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20?= =?UTF-8?q?=EB=B9=8C=EB=8D=94=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EC=B9=BC?= =?UTF-8?q?=EB=9F=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/users/entity/SocialType.java | 7 +++++++ .../domain/users/entity/User.java | 20 ++++++++++++++++--- .../global/initData/BaseInitData.java | 5 +++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/back/web7_9_codecrete_be/domain/users/entity/SocialType.java diff --git a/src/main/java/com/back/web7_9_codecrete_be/domain/users/entity/SocialType.java b/src/main/java/com/back/web7_9_codecrete_be/domain/users/entity/SocialType.java new file mode 100644 index 00000000..7d3449bd --- /dev/null +++ b/src/main/java/com/back/web7_9_codecrete_be/domain/users/entity/SocialType.java @@ -0,0 +1,7 @@ +package com.back.web7_9_codecrete_be.domain.users.entity; + +public enum SocialType { + LOCAL, // 일반 회원 + KAKAO, // 카카오 + GOOGLE // 구글 +} diff --git a/src/main/java/com/back/web7_9_codecrete_be/domain/users/entity/User.java b/src/main/java/com/back/web7_9_codecrete_be/domain/users/entity/User.java index 1b218e85..52ed97c6 100644 --- a/src/main/java/com/back/web7_9_codecrete_be/domain/users/entity/User.java +++ b/src/main/java/com/back/web7_9_codecrete_be/domain/users/entity/User.java @@ -28,10 +28,12 @@ public class User { @Column(nullable = false, unique = true, length = 20) private String nickname; - @Column(nullable = false, length = 100) + // 소셜 로그인 사용자는 password가 없을 수 있으므로 nullable = true + @Column(length = 100) private String password; - @Column(nullable = false) + // 소셜 로그인 시 생년월일을 불러오지 못하므로 nullable = true + @Column(nullable = true) private LocalDate birth; @Column(name = "profile_image", length = 255) @@ -59,18 +61,30 @@ public class User { @Column(name = "is_deleted", nullable = false) private Boolean isDeleted; + // 소셜 로그인용 컬럼 추가 + @Enumerated(EnumType.STRING) + @Column(name = "social_type", nullable = false, length = 20) + private SocialType socialType; + + @Column(name = "social_id", length = 100) + private String socialId; + @Builder public User(String email, String nickname, String password, LocalDate birth, - String profileImage) { + String profileImage, + SocialType socialType, + String socialId) { this.email = email; this.nickname = nickname; this.password = password; this.birth = birth; this.profileImage = profileImage; + this.socialType = socialType; + this.socialId = socialId; // 기본값 세팅 this.role = Role.USER; diff --git a/src/main/java/com/back/web7_9_codecrete_be/global/initData/BaseInitData.java b/src/main/java/com/back/web7_9_codecrete_be/global/initData/BaseInitData.java index e50cc942..381af50b 100644 --- a/src/main/java/com/back/web7_9_codecrete_be/global/initData/BaseInitData.java +++ b/src/main/java/com/back/web7_9_codecrete_be/global/initData/BaseInitData.java @@ -1,5 +1,6 @@ package com.back.web7_9_codecrete_be.global.initData; +import com.back.web7_9_codecrete_be.domain.users.entity.SocialType; import com.back.web7_9_codecrete_be.domain.users.entity.User; import com.back.web7_9_codecrete_be.domain.users.repository.UserRepository; import jakarta.annotation.PostConstruct; @@ -35,6 +36,8 @@ private void createTestUser() { .password(passwordEncoder.encode("test1234!")) .birth(LocalDate.of(1999, 1, 1)) .profileImage("https://example.com/profile.jpg") + .socialType(SocialType.LOCAL) + .socialId(null) .build(); userRepository.save(testUser); @@ -51,6 +54,8 @@ private void createAdminUser() { .password(passwordEncoder.encode("admin1234!")) .birth(LocalDate.of(1990, 1, 1)) .profileImage("https://example.com/profile.jpg") + .socialType(SocialType.LOCAL) + .socialId(null) .build(); // dev 전용 어드민 권한 부여 From 42f77e5ea04d9ec80af474124a483df6e68c8eb7 Mon Sep 17 00:00:00 2001 From: larama-C Date: Tue, 16 Dec 2025 16:22:41 +0900 Subject: [PATCH 4/7] =?UTF-8?q?feat:=20=EC=86=8C=EC=85=9C=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=EC=9A=A9=20=EC=A1=B0=ED=9A=8C=20=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/users/repository/UserRepository.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/com/back/web7_9_codecrete_be/domain/users/repository/UserRepository.java b/src/main/java/com/back/web7_9_codecrete_be/domain/users/repository/UserRepository.java index ea2029ec..86d3207c 100644 --- a/src/main/java/com/back/web7_9_codecrete_be/domain/users/repository/UserRepository.java +++ b/src/main/java/com/back/web7_9_codecrete_be/domain/users/repository/UserRepository.java @@ -1,5 +1,6 @@ package com.back.web7_9_codecrete_be.domain.users.repository; +import com.back.web7_9_codecrete_be.domain.users.entity.SocialType; import com.back.web7_9_codecrete_be.domain.users.entity.User; import com.back.web7_9_codecrete_be.domain.users.entity.UserStatus; import org.springframework.data.jpa.repository.JpaRepository; @@ -19,4 +20,18 @@ List findByIsDeletedTrueAndStatusAndDeletedDateBefore( LocalDateTime time ); Optional findByEmailAndIsDeletedTrue(String email); + + // 소셜 로그인 관련 추가 메서드 + + // 소셜 로그인용: 소셜 타입 + 소셜 ID 조회 + Optional findBySocialTypeAndSocialId( + SocialType socialType, + String socialId + ); + + // 소셜 회원가입용: 이메일 + 소셜 타입 조회 + Optional findByEmailAndSocialType( + String email, + SocialType socialType + ); } From 2696912a87dd57930d633db0f0906396285cf657 Mon Sep 17 00:00:00 2001 From: larama-C Date: Tue, 16 Dec 2025 16:23:14 +0900 Subject: [PATCH 5/7] =?UTF-8?q?feat:=20=EC=86=8C=EC=85=9C=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=EC=9A=A9=20DTO=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/dto/kakao/KakaoTokenResponse.java | 14 ++++++++ .../domain/auth/dto/kakao/KakaoUserInfo.java | 13 +++++++ .../auth/dto/kakao/KakaoUserResponse.java | 36 +++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 src/main/java/com/back/web7_9_codecrete_be/domain/auth/dto/kakao/KakaoTokenResponse.java create mode 100644 src/main/java/com/back/web7_9_codecrete_be/domain/auth/dto/kakao/KakaoUserInfo.java create mode 100644 src/main/java/com/back/web7_9_codecrete_be/domain/auth/dto/kakao/KakaoUserResponse.java diff --git a/src/main/java/com/back/web7_9_codecrete_be/domain/auth/dto/kakao/KakaoTokenResponse.java b/src/main/java/com/back/web7_9_codecrete_be/domain/auth/dto/kakao/KakaoTokenResponse.java new file mode 100644 index 00000000..e26ddee2 --- /dev/null +++ b/src/main/java/com/back/web7_9_codecrete_be/domain/auth/dto/kakao/KakaoTokenResponse.java @@ -0,0 +1,14 @@ +package com.back.web7_9_codecrete_be.domain.auth.dto.kakao; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; + +@Getter +public class KakaoTokenResponse { + + @JsonProperty("access_token") + private String accessToken; + + @JsonProperty("expires_in") + private int expiresIn; +} diff --git a/src/main/java/com/back/web7_9_codecrete_be/domain/auth/dto/kakao/KakaoUserInfo.java b/src/main/java/com/back/web7_9_codecrete_be/domain/auth/dto/kakao/KakaoUserInfo.java new file mode 100644 index 00000000..c3a84e1e --- /dev/null +++ b/src/main/java/com/back/web7_9_codecrete_be/domain/auth/dto/kakao/KakaoUserInfo.java @@ -0,0 +1,13 @@ +package com.back.web7_9_codecrete_be.domain.auth.dto.kakao; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class KakaoUserInfo { + private String socialId; + private String email; + private String nickname; + private String profileImageUrl; +} diff --git a/src/main/java/com/back/web7_9_codecrete_be/domain/auth/dto/kakao/KakaoUserResponse.java b/src/main/java/com/back/web7_9_codecrete_be/domain/auth/dto/kakao/KakaoUserResponse.java new file mode 100644 index 00000000..7895aaab --- /dev/null +++ b/src/main/java/com/back/web7_9_codecrete_be/domain/auth/dto/kakao/KakaoUserResponse.java @@ -0,0 +1,36 @@ +package com.back.web7_9_codecrete_be.domain.auth.dto.kakao; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; + +@Getter +public class KakaoUserResponse { + + private Long id; + + @JsonProperty("kakao_account") + private KakaoAccount kakaoAccount; + + public KakaoUserInfo toUserInfo() { + return new KakaoUserInfo( + String.valueOf(id), + kakaoAccount.getEmail(), + kakaoAccount.getProfile().getNickname(), + kakaoAccount.getProfile().getProfileImageUrl() + ); + } + + @Getter + public static class KakaoAccount { + private String email; + private Profile profile; + } + + @Getter + public static class Profile { + private String nickname; + + @JsonProperty("profile_image_url") + private String profileImageUrl; + } +} From dc3a59e3507ff493b5b1b3b144b10f9db77b6063 Mon Sep 17 00:00:00 2001 From: larama-C Date: Tue, 16 Dec 2025 16:24:03 +0900 Subject: [PATCH 6/7] =?UTF-8?q?feat:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=EC=86=8C=EC=85=9C=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/AuthController.java | 14 ++++ .../domain/auth/service/AuthService.java | 66 +++++++++++++++++ .../auth/service/KakaoOAuthService.java | 74 +++++++++++++++++++ .../global/error/code/AuthErrorCode.java | 2 + 4 files changed, 156 insertions(+) create mode 100644 src/main/java/com/back/web7_9_codecrete_be/domain/auth/service/KakaoOAuthService.java diff --git a/src/main/java/com/back/web7_9_codecrete_be/domain/auth/controller/AuthController.java b/src/main/java/com/back/web7_9_codecrete_be/domain/auth/controller/AuthController.java index c7f40e15..813390dd 100644 --- a/src/main/java/com/back/web7_9_codecrete_be/domain/auth/controller/AuthController.java +++ b/src/main/java/com/back/web7_9_codecrete_be/domain/auth/controller/AuthController.java @@ -90,4 +90,18 @@ public RsData refresh() { String newAccessToken = tokenService.reissueAccessToken(); return RsData.success("토큰 재발급 완료", newAccessToken); } + + @Operation(summary = "카카오 소셜 로그인", description = "카카오 OAuth 인가 코드를 이용해 로그인/회원가입을 진행합니다.") + @GetMapping("/login/kakao") + public RsData kakaoLogin(@RequestParam String code) { + LoginResponse response = authService.kakaoLogin(code); + return RsData.success("카카오 로그인 성공", response); + } + + @Operation(summary = "구글 소셜 로그인", description = "구글 OAuth 인가 코드를 이용해 로그인/회원가입을 진행합니다.") + @GetMapping("/login/google") + public RsData googleLogin(@RequestParam String code) { + LoginResponse response = authService.googleLogin(code); + return RsData.success("구글 로그인 성공", response); + } } diff --git a/src/main/java/com/back/web7_9_codecrete_be/domain/auth/service/AuthService.java b/src/main/java/com/back/web7_9_codecrete_be/domain/auth/service/AuthService.java index 30013ccc..363bca2b 100644 --- a/src/main/java/com/back/web7_9_codecrete_be/domain/auth/service/AuthService.java +++ b/src/main/java/com/back/web7_9_codecrete_be/domain/auth/service/AuthService.java @@ -1,9 +1,11 @@ package com.back.web7_9_codecrete_be.domain.auth.service; +import com.back.web7_9_codecrete_be.domain.auth.dto.kakao.KakaoUserInfo; import com.back.web7_9_codecrete_be.domain.auth.dto.request.LoginRequest; import com.back.web7_9_codecrete_be.domain.auth.dto.request.SignupRequest; import com.back.web7_9_codecrete_be.domain.auth.dto.response.LoginResponse; import com.back.web7_9_codecrete_be.domain.email.service.EmailService; +import com.back.web7_9_codecrete_be.domain.users.entity.SocialType; import com.back.web7_9_codecrete_be.domain.users.entity.User; import com.back.web7_9_codecrete_be.domain.users.repository.UserRepository; import com.back.web7_9_codecrete_be.global.error.code.AuthErrorCode; @@ -25,6 +27,7 @@ public class AuthService { private final PasswordEncoder passwordEncoder; private final EmailService emailService; private final TokenService tokenService; + private final KakaoOAuthService kakaoOAuthService; // 회원가입 public void signUp(SignupRequest req) { @@ -50,6 +53,8 @@ public void signUp(SignupRequest req) { .password(passwordEncoder.encode(req.getPassword())) .birth(LocalDate.parse(req.getBirth())) .profileImage(req.getProfileImage()) + .socialType(SocialType.LOCAL) + .socialId(null) .build(); userRepository.save(user); @@ -66,6 +71,10 @@ public LoginResponse login(LoginRequest req) { throw new BusinessException(UserErrorCode.USER_DELETED); } + if (user.getSocialType() != SocialType.LOCAL) { + throw new BusinessException(AuthErrorCode.SOCIAL_USER_CANNOT_LOGIN); + } + if (!passwordEncoder.matches(req.getPassword(), user.getPassword())) { throw new BusinessException(AuthErrorCode.INVALID_PASSWORD); } @@ -119,4 +128,61 @@ private String generateTempPassword() { } return sb.toString(); } + + @Transactional + public LoginResponse kakaoLogin(String code) { + + // 1. 인가 코드 → 카카오 Access Token + String kakaoAccessToken = kakaoOAuthService.getAccessToken(code); + + // 2. Access Token → 사용자 정보 + KakaoUserInfo kakaoUserInfo = kakaoOAuthService.getUserInfo(kakaoAccessToken); + + if (kakaoUserInfo.getEmail() == null) { + throw new BusinessException(AuthErrorCode.SOCIAL_EMAIL_NOT_PROVIDED); + } + + // 3. 소셜 ID 기준 사용자 조회 + User user = userRepository + .findBySocialTypeAndSocialId( + SocialType.KAKAO, + kakaoUserInfo.getSocialId() + ) + .orElseGet(() -> registerKakaoUser(kakaoUserInfo)); + + // 4. 탈퇴 사용자 체크 + if (user.getIsDeleted()) { + throw new BusinessException(UserErrorCode.USER_DELETED); + } + + // 5. 토큰 발급 + tokenService.issueTokens(user); + + return new LoginResponse(user.getId(), user.getNickname()); + } + + private User registerKakaoUser(KakaoUserInfo info) { + + String nickname = info.getNickname(); + if (userRepository.existsByNickname(nickname)) { + nickname = nickname + "_" + System.currentTimeMillis(); + } + + User user = User.builder() + .email(info.getEmail()) + .nickname(nickname) + .password(null) + .birth(null) + .profileImage(info.getProfileImageUrl()) + .socialType(SocialType.KAKAO) + .socialId(info.getSocialId()) + .build(); + + return userRepository.save(user); + } + + public LoginResponse googleLogin(String code) { + // TODO: 구글 인가 코드 → 사용자 정보 → 로그인 처리 + throw new UnsupportedOperationException("구글 로그인 미구현"); + } } diff --git a/src/main/java/com/back/web7_9_codecrete_be/domain/auth/service/KakaoOAuthService.java b/src/main/java/com/back/web7_9_codecrete_be/domain/auth/service/KakaoOAuthService.java new file mode 100644 index 00000000..70473baa --- /dev/null +++ b/src/main/java/com/back/web7_9_codecrete_be/domain/auth/service/KakaoOAuthService.java @@ -0,0 +1,74 @@ +package com.back.web7_9_codecrete_be.domain.auth.service; + +import com.back.web7_9_codecrete_be.domain.auth.dto.kakao.KakaoTokenResponse; +import com.back.web7_9_codecrete_be.domain.auth.dto.kakao.KakaoUserInfo; +import com.back.web7_9_codecrete_be.domain.auth.dto.kakao.KakaoUserResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.*; +import org.springframework.stereotype.Service; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; + +@Service +@RequiredArgsConstructor +public class KakaoOAuthService { + + @Value("${oauth.kakao.client-id}") + private String clientId; + + @Value("${oauth.kakao.redirect-uri}") + private String redirectUri; + + @Value("${oauth.kakao.client-secret}") + private String clientSecret; + + private static final String TOKEN_URL = "https://kauth.kakao.com/oauth/token"; + private static final String USER_INFO_URL = "https://kapi.kakao.com/v2/user/me"; + + private final RestTemplate restTemplate = new RestTemplate(); + + // 인가 코드 → 액세스 토큰 + public String getAccessToken(String code) { + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + + MultiValueMap params = new LinkedMultiValueMap<>(); + params.add("grant_type", "authorization_code"); + params.add("client_id", clientId); + params.add("client_secret", clientSecret); + params.add("redirect_uri", redirectUri); + params.add("code", code); + + HttpEntity> request = + new HttpEntity<>(params, headers); + + ResponseEntity response = + restTemplate.postForEntity( + TOKEN_URL, + request, + KakaoTokenResponse.class + ); + + return response.getBody().getAccessToken(); + } + + // 인가 코드 → 카카오 사용자 정보 + public KakaoUserInfo getUserInfo(String accessToken) { + HttpHeaders headers = new HttpHeaders(); + headers.setBearerAuth(accessToken); + + HttpEntity request = new HttpEntity<>(headers); + + ResponseEntity response = + restTemplate.exchange( + USER_INFO_URL, + HttpMethod.GET, + request, + KakaoUserResponse.class + ); + + return response.getBody().toUserInfo(); + } +} diff --git a/src/main/java/com/back/web7_9_codecrete_be/global/error/code/AuthErrorCode.java b/src/main/java/com/back/web7_9_codecrete_be/global/error/code/AuthErrorCode.java index 392d43d2..87d075b4 100644 --- a/src/main/java/com/back/web7_9_codecrete_be/global/error/code/AuthErrorCode.java +++ b/src/main/java/com/back/web7_9_codecrete_be/global/error/code/AuthErrorCode.java @@ -17,6 +17,8 @@ public enum AuthErrorCode implements ErrorCode { USER_NOT_FOUND(HttpStatus.NOT_FOUND, "A-110", "존재하지 않는 이메일입니다."), INVALID_PASSWORD(HttpStatus.UNAUTHORIZED, "A-111", "비밀번호가 일치하지 않습니다."), USER_INACTIVE(HttpStatus.FORBIDDEN, "A-112", "현재 비활성화된 계정입니다."), + SOCIAL_USER_CANNOT_LOGIN(HttpStatus.BAD_REQUEST, "A-113", "소셜 로그인 계정은 일반 로그인으로 로그인할 수 없습니다."), + SOCIAL_EMAIL_NOT_PROVIDED(HttpStatus.BAD_REQUEST, "A-114", "소셜 계정에서 이메일 정보를 제공하지 않았습니다."), // 권한 관련 UNAUTHORIZED_USER(HttpStatus.UNAUTHORIZED, "A-120", "로그인이 필요합니다."), From 18b72e77a90a8e15265597d86db3218d9147d9ee Mon Sep 17 00:00:00 2001 From: larama-C Date: Tue, 16 Dec 2025 16:39:17 +0900 Subject: [PATCH 7/7] =?UTF-8?q?CI=20:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=EC=86=8C=EC=85=9C=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=ED=99=98?= =?UTF-8?q?=EA=B2=BD=20=EB=B3=80=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e57b6f2..61e86a1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,9 @@ jobs: TMAP_API_KEY: ${{ secrets.TMAP_API_KEY }} KAKAOMAP_API_KEY: ${{ secrets.KAKAOMAP_API_KEY }} - + KAKAO_REST_API_KEY: ${{ secrets.KAKAO_REST_API_KEY }} + KAKAO_CLIENT_SECRET: ${{ secrets.KAKAO_CLIENT_SECRET }} + KAKAO_REDIRECT_URI: ${{ secrets.KAKAO_REDIRECT_URI }} steps: - name: Checkout