From c323b5b2e4685b06285be05b1e649f67824c05a0 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 7 Jul 2026 18:44:31 -0700 Subject: [PATCH] Enhancement: support dockhand api key auth (#6848) --- docs/widgets/services/dockhand.md | 1 + src/widgets/dockhand/proxy.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/widgets/services/dockhand.md b/docs/widgets/services/dockhand.md index 7267d43bd..5bade1295 100644 --- a/docs/widgets/services/dockhand.md +++ b/docs/widgets/services/dockhand.md @@ -17,4 +17,5 @@ widget: environment: local # optional: name or id; aggregates all when omitted username: your-user # required for local auth password: your-pass # required for local auth + key: dockhandapikey # optional, if using API key auth instead of username/password ``` diff --git a/src/widgets/dockhand/proxy.js b/src/widgets/dockhand/proxy.js index c93e7bf39..658dd06a7 100644 --- a/src/widgets/dockhand/proxy.js +++ b/src/widgets/dockhand/proxy.js @@ -38,12 +38,18 @@ export default async function dockhandProxyHandler(req, res) { const url = new URL(formatApiCall(widgets[widget.type].api, { endpoint, ...widget })); + const headers = {}; + if (widget.key) { + headers.Authorization = `Bearer ${widget.key}`; + } + let [status, contentType, data] = await httpProxy(url, { method: req.method, + headers, }); - // Attempt login and retrying once - if (status === 401) { + // Attempt login (username + password only) and retry once + if (status === 401 && !widget.key) { const loggedIn = await login(widget); if (loggedIn) { [status, contentType, data] = await httpProxy(url, {