99import  org .springframework .util .MultiValueMap ;
1010import  org .springframework .web .client .RestTemplate ;
1111import  org .springframework .beans .factory .annotation .Value ;
12+ import  org .slf4j .Logger ;
13+ import  org .slf4j .LoggerFactory ;
1214
1315import  java .util .Collections ;
1416import  java .util .HashMap ;
@@ -29,15 +31,18 @@ public class KakaoAuthImpl implements KakaoAuthService {
2931    private  String  KAKAO_REDIRECT_URL_LOCAL ;
3032
3133    private  final  HttpServletRequest  request ;
34+     private  static  final  Logger  log  = LoggerFactory .getLogger (KakaoAuthImpl .class );
3235
3336    public  KakaoAuthImpl (HttpServletRequest  request ) {
3437        this .request  = request ;
3538    }
3639
3740    // 1. OAuth2 Access Token 발급 
3841    @ Override 
39-     public  String  getAccessToken (String  code ) {
40-         System .out .println ("[KakaoAuth] Authorization code 수신: "  + code );
42+     public  TokenDto  getAccessToken (String  code ) {
43+         log .info ("카카오 인증 코드: {}" , code );
44+         log .info ("사용하는 리다이렉트 URI: {}" , redirectUri );
45+         
4146        RestTemplate  restTemplate  = new  RestTemplate ();
4247
4348        HttpHeaders  headers  = new  HttpHeaders ();
@@ -67,7 +72,7 @@ public String getAccessToken(String code) {
6772            JsonNode  jsonNode  = objectMapper .readTree (response .getBody ());
6873            String  accessToken  = jsonNode .get ("access_token" ).asText ();
6974            System .out .println ("[KakaoAuth] Access Token 발급 성공" );
70-             return  accessToken ;
75+             return  new   TokenDto ( accessToken ) ;
7176        } catch  (Exception  e ) {
7277            System .err .println ("[KakaoAuth] Access Token 발급 실패: "  + e .getMessage ());
7378            throw  new  RuntimeException ("카카오 Access Token 요청 실패" , e );
0 commit comments