Skip to content

Commit

Permalink
[FEAT] OAuth2SuccessHandler 로컬 주소로 임시 고정
Browse files Browse the repository at this point in the history
  • Loading branch information
bbabbi committed Dec 1, 2024
1 parent a2af87c commit 458b98d
Showing 1 changed file with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,8 @@ public void onAuthenticationSuccess(HttpServletRequest request, HttpServletRespo
// RefreshToken 저장
tokenService.saveRefreshToken(user.getUserId(), jwtRefreshToken);


String origin = request.getHeader("Origin");
if (origin == null) {
origin = request.getHeader("Referer");
}

// baseUrl 추출
String clientBaseUrl;
if (origin != null) {
clientBaseUrl = origin.split("/")[0] + "//" + origin.split("/")[2];
} else {
clientBaseUrl = "http://localhost:3000";
}

String redirectUrl = clientBaseUrl + "/oauth2/success?accessToken=" + jwtAccessToken + "&refreshToken=" + jwtRefreshToken;
// 클라이언트로 리다이렉트
String redirectUrl = "http://localhost:3000/oauth2/success?accessToken=" + jwtAccessToken + "&refreshToken=" + jwtRefreshToken;
response.sendRedirect(redirectUrl);
}
}

0 comments on commit 458b98d

Please sign in to comment.