mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-01 21:13:39 +01:00
Merge pull request #1031 from benphelps/fix-1025
Fix homebridge config UI-X API expires login with 403
This commit is contained in:
commit
b69bb94253
@ -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 };
|
||||
|
Loading…
x
Reference in New Issue
Block a user