From 9df4ba088192d7d3897ddb3edc99d6ba0e7bb12c Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon, 20 Feb 2023 14:58:19 -0800 Subject: [PATCH] Fix homebridge config UI-X API expires login with 403 --- src/widgets/homebridge/proxy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/homebridge/proxy.js b/src/widgets/homebridge/proxy.js index 0ed6d8591..ba2bd0caa 100644 --- a/src/widgets/homebridge/proxy.js +++ b/src/widgets/homebridge/proxy.js @@ -50,7 +50,7 @@ async function apiCall(widget, endpoint, service) { headers, }); - if (status === 401) { + if (status === 401 || status === 403) { logger.debug("Homebridge API rejected the request, attempting to obtain new session token"); const { accessToken } = login(widget, service); headers.Authorization = `Bearer ${accessToken}`; @@ -63,7 +63,7 @@ async function apiCall(widget, endpoint, service) { } if (status !== 200) { - logger.error("Error getting data from Homebridge: %d. Data: %s", status, data); + logger.error("Error getting data from Homebridge: %s status %d. Data: %s", url, status, data); } return { status, contentType, data: JSON.parse(data.toString()), responseHeaders };