diff --git a/src/utils/proxies/generic.js b/src/utils/proxies/generic.js index 83dfeca1b..9e0a6a676 100644 --- a/src/utils/proxies/generic.js +++ b/src/utils/proxies/generic.js @@ -10,8 +10,17 @@ export default async function genericProxyHandler(req, res) { if (widget) { const url = new URL(formatApiCall(widget.type, { endpoint, ...widget })); + + let headers; + if (widget.username && widget.password) { + headers = { + Authorization: `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`, + }; + } + const [status, contentType, data] = await httpProxy(url, { method: req.method, + headers, }); if (contentType) res.setHeader("Content-Type", contentType);