Skip to content

Commit 6a131d5

Browse files
authored
Feat: 소셜 로그인 성공 시 리다이렉트 (#108)
1 parent 991d70b commit 6a131d5

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

src/main/java/com/back/global/security/oauth/OAuth2LoginSuccessHandler.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.springframework.security.core.Authentication;
1919
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
2020
import org.springframework.stereotype.Component;
21+
import org.springframework.web.util.UriComponentsBuilder;
2122

2223
import java.io.IOException;
2324
import java.time.LocalDateTime;
@@ -71,21 +72,8 @@ public void onAuthenticationSuccess(HttpServletRequest request,
7172
true
7273
);
7374

74-
// 응답 데이터 구성
75-
LoginResponse loginResponse = new LoginResponse(
76-
accessToken,
77-
UserResponse.from(user)
78-
);
79-
80-
RsData<LoginResponse> rsData = RsData.success(
81-
"소셜 로그인에 성공했습니다.",
82-
loginResponse
83-
);
84-
85-
// JSON 직렬화 후 응답
86-
response.setStatus(HttpServletResponse.SC_OK);
87-
response.setContentType("application/json;charset=UTF-8");
88-
objectMapper.writeValue(response.getWriter(), rsData);
75+
// 프론트엔드 리다이렉트
76+
response.sendRedirect("http://localhost:3000/login/oauth2");
8977
} catch (CustomException e) {
9078
handleException(response, e);
9179
} catch (Exception e) {

0 commit comments

Comments
 (0)