diff --git a/src/main/java/com/example/moyeothon/Controller/UserController.java b/src/main/java/com/example/moyeothon/Controller/UserController.java index eba2cd4..835dc14 100644 --- a/src/main/java/com/example/moyeothon/Controller/UserController.java +++ b/src/main/java/com/example/moyeothon/Controller/UserController.java @@ -63,7 +63,7 @@ public ResponseEntity updateNickname(@PathVariable String uid, @Request // 카카오 로그인 성공 시 호출되는 엔드포인트 (GET) @Operation(summary = "카카오 로그인 성공 시 호출되는 엔드포인트 (GET)") @GetMapping("/oauth2/code/kakao") - public ResponseEntity kakaoCallback(@RequestParam(name = "code") String code) { + public ResponseEntity kakaoCallback(@RequestParam String code) { return ResponseEntity.ok(userService.loginWithOAuth2(code)); } diff --git a/src/main/java/com/example/moyeothon/Service/UserService.java b/src/main/java/com/example/moyeothon/Service/UserService.java index 0737581..1e690db 100644 --- a/src/main/java/com/example/moyeothon/Service/UserService.java +++ b/src/main/java/com/example/moyeothon/Service/UserService.java @@ -158,7 +158,6 @@ public void logKakaoOAuthSettings() { kakaoOAuthProperties.getClientSecret(), kakaoOAuthProperties.getRedirectUri()); - // 카카오 로그인 URL 로깅 String authorizationUrl = String.format( "https://kauth.kakao.com/oauth/authorize?client_id=%s&redirect_uri=%s&response_type=code", kakaoOAuthProperties.getClientId(), @@ -167,6 +166,21 @@ public void logKakaoOAuthSettings() { logger.info("카카오 로그인 URL : {}", authorizationUrl); } + @PostConstruct + public void logGoogleOAuthSettings(){ + logger.info("구글 로그인 설정 값 - clientId : {}, clientSecret : {}, redirectUri : {}", + googleOAuthProperties.getClientId(), + googleOAuthProperties.getClientSecret(), + googleOAuthProperties.getRedirectUri()); + + String authorizationUrl = String.format( + "https://accounts.google.com/o/oauth2/v2/auth?client_id=%s&redirect_uri=%s&response_type=code&scope=email%%20profile", + googleOAuthProperties.getClientId(), + googleOAuthProperties.getRedirectUri() + ); + logger.info("구글 로그인 URL : {}", authorizationUrl); + } + // 카카오 인가 코드로 액세스 토큰을 요청하는 메서드 public String getAccessToken(String code) { String url = "https://kauth.kakao.com/oauth/token";