fix: 유튜브 인증 만료 안내 개선

This commit is contained in:
hehihoho3@gmail.com 2026-09-08 09:08:34 +09:00
parent 118ca72281
commit 0f7288237b
2 changed files with 11 additions and 1 deletions

View File

@ -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을 갱신하지 못했습니다.");
}

View File

@ -45,6 +45,7 @@
<label>종료일 <input id="endDate" type="date"></label>
<button type="button" class="btn btn-secondary btn-small" onclick="loadReport()">적용</button>
</div>
<button type="button" class="btn btn-secondary btn-small" onclick="connectYoutube()"><i data-lucide="link"></i> 채널 다시 연결</button>
<button type="button" class="btn btn-secondary refresh-button" onclick="loadReport()"><i data-lucide="refresh-cw"></i> 새로고침</button>
</section>