OAuth2 Login- AuthenticationSuccessHandler
·
Issues
이슈 OAuth2 로그인 과정에서, authentication을 이용해 jwt를 만들어서 response-header에 전달해주기 위해 AuthenticationSuccessHandler을 상속 받은 클래스를 커스텀해서 successHandler로 등록했다. @Component @RequiredArgsConstructor public class OAuth2SuccessHandler implements AuthenticationSuccessHandler, AuthenticationFailureHandler { private final JWTUtil jwtUtil; @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpS..
OAuth2(2) OAuth2 Client 라이브러리 없이 카카오 로그인
·
Programming/Spring
카카오 로그인 동작 과정 1. 인증 코드 요청 카카오 인증 서버는 해당 사용자에 대한 인가 코드를 발급해 서비스의 redirect_uri에 전달한다. URL GET /oauth/authorize?client_id={REST_API_KEY}&redirect_uri={REDIRECT_URI}&response_type=code HTTP/1.1 Host: kauth.kakao.com 코드 @GetMapping("/login/oauth2/code/kakao") public String getCode(String code) { return code; } 2. 인증 토큰 요청 인증 코드를 요청에 실어 보낸다. 코드 @GetMapping("/login/oauth2/code/kakao") public ResponseEn..