
오늘은 부트캠프 72일차이다. 오전에는 어제 카카오를 이용한 소셜 로그인을 구현을 하였고, 404에러 난 후 새로고침을 해야만 임시 페이지로 넘어가는 코드를 팀원들과 함께 문제를 풀어나갔고 redirect url을 인텔리제이의 url에서 vscode의 url로 수정하여서 오류를 고칠 수가 있었고, 코드를 약간 리펙토링을 하여 push를 하였고, 이제 다음 프로필 수정을 구현해야겠다.
Controller
@GetMapping("/kakao-login") public void kakaoLogin(@RequestParam String code, HttpServletResponse response) throws JsonProcessingException { // code: 카카오 서버로부터 받은 인가 코드 String createToken = authService.kakaoLogin(code, response); // Cookie 생성 및 직접 브라우저에 Set Cookie cookie = new Cookie(JwtUtil.AUTHORIZATION_HEADER, createToken.substring(7)); cookie.setPath("/"); response.addCookie(cookie); }Dto
public KakaoUserInfoDto(Long id, String nicknmae, String email) { this.id = id; this.nicknmae = nicknmae; this.email = email;index.html
<button id="login-kakao-btn" onclick="location.href='https://kauth.kakao.com/oauth/authorize?client_id=b8054d0d502a7f824aa2ca329d139607&redirect_uri=http://localhost:5500/index.html&response_type=code'"> 카카오로 로그인하기 </button> ```