Skip to content

Commit bf3cc4b

Browse files
authored
Merge pull request #48 from Grow-Fit/bug/47-login
리다이렉트 url 수정 및 환경변수로 설정
2 parents 4fd76a8 + 12be729 commit bf3cc4b

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/main/java/com/project/growfit/domain/User/controller/OAuthController.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import io.swagger.v3.oas.annotations.tags.Tag;
1010
import jakarta.servlet.http.HttpServletResponse;
1111
import lombok.RequiredArgsConstructor;
12+
import org.springframework.beans.factory.annotation.Value;
1213
import org.springframework.http.HttpStatus;
1314
import org.springframework.http.ResponseEntity;
1415
import org.springframework.web.bind.annotation.*;
@@ -19,6 +20,12 @@
1920
@Tag(name = "Social OAuth API", description = "소셜 로그인 관련 API (카카오)")
2021
public class OAuthController {
2122

23+
@Value("${custom.oauth2.kakao.redirect.new-user}")
24+
private String newUserRedirectUrl;
25+
26+
@Value("${custom.oauth2.kakao.redirect.existing-user}")
27+
private String existingUserRedirectUrl;
28+
2229
private final OauthService oauthService;
2330

2431
@Operation(summary = "카카오 소셜 로그인 API")
@@ -37,8 +44,8 @@ public void kakaoLogin(@RequestParam(value = "code", required = false) String co
3744
ResultResponse<?> resultResponse = oauthService.kakaoLogin(accessToken, response);
3845
ParentLoginResponseDto dto = (ParentLoginResponseDto) resultResponse.getData();
3946
String redirectUrl = dto.isNewUser()
40-
? "https://localhost:3000/join/parent/1"
41-
: "https://localhost:3000";
47+
? newUserRedirectUrl
48+
: existingUserRedirectUrl;
4249
response.sendRedirect(redirectUrl);
4350
} catch (BusinessException e) {
4451
try {

0 commit comments

Comments
 (0)