From 115547c5be18ba9ffa0b8d37c37eda8e2be36f23 Mon Sep 17 00:00:00 2001 From: tjdals4716 Date: Sat, 2 Nov 2024 21:36:53 +0900 Subject: [PATCH] =?UTF-8?q?:recycle:=20=EA=B5=AC=EA=B8=80=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EB=A1=9C=EA=B7=B8=20=EB=9D=84=EC=9A=B0?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moyeothon/Controller/UserController.java | 2 +- .../example/moyeothon/Service/UserService.java | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) 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";