From 0f7288237b6f1b887a8018213ba201a7b761e687 Mon Sep 17 00:00:00 2001 From: "hehihoho3@gmail.com" Date: Tue, 8 Sep 2026 09:08:34 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9C=A0=ED=8A=9C=EB=B8=8C=20=EC=9D=B8?= =?UTF-8?q?=EC=A6=9D=20=EB=A7=8C=EB=A3=8C=20=EC=95=88=EB=82=B4=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yanalyst/domain/upload/YoutubeOAuthService.java | 11 ++++++++++- src/main/resources/templates/my_channel.html | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthService.java b/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthService.java index dd1bd99..cbede1d 100644 --- a/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthService.java +++ b/src/main/java/com/hlab/yanalyst/domain/upload/YoutubeOAuthService.java @@ -183,7 +183,16 @@ public class YoutubeOAuthService { form.add("grant_type", "refresh_token"); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); - JsonNode token = readJson(restTemplate.postForObject(TOKEN_URL, new HttpEntity<>(form, headers), String.class)); + String response; + try { + response = restTemplate.postForObject(TOKEN_URL, new HttpEntity<>(form, headers), String.class); + } catch (HttpStatusCodeException e) { + if (e.getStatusCode().value() == 400 || e.getStatusCode().value() == 401) { + throw new IllegalStateException("YouTube 채널 연결이 만료되었습니다. 채널을 다시 연결해 주세요.", e); + } + throw new IllegalStateException("YouTube 인증 정보를 갱신하지 못했습니다.", e); + } + JsonNode token = readJson(response); return requiredText(token, "access_token", "YouTube access token을 갱신하지 못했습니다."); } diff --git a/src/main/resources/templates/my_channel.html b/src/main/resources/templates/my_channel.html index daa22ae..4d632ec 100644 --- a/src/main/resources/templates/my_channel.html +++ b/src/main/resources/templates/my_channel.html @@ -45,6 +45,7 @@ +