Skip to content

Commit

Permalink
♻️ 구글 로그인 로그 띄우기
Browse files Browse the repository at this point in the history
  • Loading branch information
tjdals4716 committed Nov 2, 2024
1 parent 59d5dc2 commit 115547c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public ResponseEntity<UserDTO> updateNickname(@PathVariable String uid, @Request
// 카카오 로그인 성공 시 호출되는 엔드포인트 (GET)
@Operation(summary = "카카오 로그인 성공 시 호출되는 엔드포인트 (GET)")
@GetMapping("/oauth2/code/kakao")
public ResponseEntity<JWTDTO> kakaoCallback(@RequestParam(name = "code") String code) {
public ResponseEntity<JWTDTO> kakaoCallback(@RequestParam String code) {
return ResponseEntity.ok(userService.loginWithOAuth2(code));
}

Expand Down
16 changes: 15 additions & 1 deletion src/main/java/com/example/moyeothon/Service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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";
Expand Down

0 comments on commit 115547c

Please sign in to comment.