Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

feat(wud): support personal API tokens (#7275)

xfdzcoder8ab24207118f
diff --git a/apps/docs/docs/integrations/whats-up-docker/index.mdx b/apps/docs/docs/integrations/whats-up-docker/index.mdx
index 7877ce516..25dd077c6 100644
--- a/apps/docs/docs/integrations/whats-up-docker/index.mdx
+++ b/apps/docs/docs/integrations/whats-up-docker/index.mdx
@@ -31,15 +31,20 @@ Use the root URL of your WUD instance, for example `https://wud.example.com`. Ho
### Secrets
-WUD 9 requires authentication. Enter your WUD username and password in Homarr; the initial admin credentials configured with `WUD_AUTH_ADMIN_USER` and `WUD_AUTH_ADMIN_PASSWORD` work with Basic authentication. Older WUD versions without authentication can leave both fields empty.
+WUD 9 requires authentication. The recommended option is a Personal API Token: in WUD, open **My Profile → Personal API Tokens**, create a token with the **read** scope, and enter it in Homarr. This also works when WUD uses OIDC and has no local password. Homarr sends the token as `Authorization: Bearer wud_...`.
+
+Username and password (HTTP Basic) remain supported for existing setups and older versions. WUD versions without authentication can leave the secrets empty.
Credentials are sent to the configured URL over HTTP or HTTPS. Use HTTPS outside a trusted internal network.
<IntegrationSecrets
secrets={[
{
- credentials: [],
- steps: [],
+ credentials: ["personalAccessToken"],
+ steps: [
+ "In WUD, open My Profile → Personal API Tokens and create a token with read access",
+ "Enter the wud_... token in Homarr; it is sent as a Bearer token",
+ ],
},
{
credentials: ["username", "password"],
@@ -48,5 +53,9 @@ Credentials are sent to the configured URL over HTTP or HTTPS. Use HTTPS outside
"Enter that username and password in Homarr — Basic authentication is handled automatically",
],
},
+ {
+ credentials: [],
+ steps: [],
+ },
]}
/>
diff --git a/packages/definitions/src/integration.ts b/packages/definitions/src/integration.ts
index a7ad3a8a8..62fcd71f0 100644
--- a/packages/definitions/src/integration.ts
+++ b/packages/definitions/src/integration.ts
@@ -1017,16 +1017,18 @@ export const integrationDefs = {
httpAuth: {
type: "modes",
modes: [
- { when: [], auth: { type: "none" } },
+ { when: ["personalAccessToken"], auth: { type: "bearer", secretKind: "personalAccessToken" } },
{ when: ["username", "password"], auth: { type: "basic" } },
+ { when: [], auth: { type: "none" } },
],
},
name: "What's Up Docker",
- secretKinds: [[], ["username", "password"]],
+ secretKinds: [["personalAccessToken"], ["username", "password"], []],
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/whats-up-docker.svg",
category: ["healthMonitoring"],
documentationSlug: "whats-up-docker",
defaultPort: 3000,
+ apiKeySettingsPath: "/profile",
},
llamacpp: {
httpAuth: { type: "none" },
diff --git a/packages/definitions/src/test/api-key-url.spec.ts b/packages/definitions/src/test/api-key-url.spec.ts
index 6e7cb9e30..32da2f3ea 100644
--- a/packages/definitions/src/test/api-key-url.spec.ts
+++ b/packages/definitions/src/test/api-key-url.spec.ts
@@ -42,6 +42,7 @@ describe("getIntegrationApiKeyUrl", () => {
["tracearr", "http://tracearr.local:7040", "http://tracearr.local:7040/settings"],
["speedtestTracker", "http://speedtest.local", "http://speedtest.local/admin/api-tokens"],
["uptimeKuma", "http://uptime.local:3001", "http://uptime.local:3001/settings/api-keys"],
+ ["wud", "http://wud.local:3000", "http://wud.local:3000/profile"],
] as const)("builds a verified credential URL for %s", (kind, baseUrl, expected) => {
expect(getIntegrationApiKeyUrl(baseUrl, kind)).toBe(expected);
});
diff --git a/packages/integrations/src/wud/test/wud-integration.spec.ts b/packages/integrations/src/wud/test/wud-integration.spec.ts
index 146c17361..f9a0101ed 100644
--- a/packages/integrations/src/wud/test/wud-integration.spec.ts
+++ b/packages/integrations/src/wud/test/wud-integration.spec.ts
@@ -22,6 +22,7 @@ vi.mock("@homarr/core/infrastructure/http", () => ({
const TEST_URL = "https://wud.example.com";
const TEST_USERNAME = "user";
const TEST_PASSWORD = "p@ss";
+const TEST_PERSONAL_ACCESS_TOKEN = "wud_test-token";
const mockFetch = vi.mocked(fetchWithTrustedCertificatesAsync);
@@ -77,6 +78,9 @@ const createIntegrationWithBasicAuth = () =>
{ kind: "password", value: TEST_PASSWORD },
]);
+const createIntegrationWithPersonalAccessToken = () =>
+ createIntegration([{ kind: "personalAccessToken", value: TEST_PERSONAL_ACCESS_TOKEN }]);
+
beforeEach(() => {
mockFetch.mockReset();
});
@@ -198,6 +202,40 @@ describe("WudIntegration authentication", () => {
expect(requestInit?.timeout).toBe(10_000);
});
+ test("sends a Bearer auth header when a personal access token is configured", async () => {
+ mockFetch.mockResolvedValue(
+ new Response(JSON.stringify(sampleContainersResponse), {
+ status: 200,
+ headers: { "content-type": "application/json" },
+ }) as unknown as Awaited<ReturnType<typeof fetchWithTrustedCertificatesAsync>>,
+ );
+
+ await createIntegrationWithPersonalAccessToken().getStatsAsync();
+
+ const [, requestInit] = mockFetch.mock.calls[0] ?? [];
+ expect(requestInit?.headers).toMatchObject({ Authorization: `Bearer ${TEST_PERSONAL_ACCESS_TOKEN}` });
+ });
+
+ test("prefers the personal access token over basic credentials", async () => {
+ mockFetch.mockResolvedValue(
+ new Response(JSON.stringify(sampleContainersResponse), {
+ status: 200,
+ headers: { "content-type": "application/json" },
+ }) as unknown as Awaited<ReturnType<typeof fetchWithTrustedCertificatesAsync>>,
+ );
+
+ const integration = createIntegration([
+ { kind: "personalAccessToken", value: TEST_PERSONAL_ACCESS_TOKEN },
+ { kind: "username", value: TEST_USERNAME },
+ { kind: "password", value: TEST_PASSWORD },
+ ]);
+
+ await integration.getStatsAsync();
+
+ const [, requestInit] = mockFetch.mock.calls[0] ?? [];
+ expect(requestInit?.headers).toMatchObject({ Authorization: `Bearer ${TEST_PERSONAL_ACCESS_TOKEN}` });
+ });
+
test("sends configured Basic auth credentials over an HTTP URL", async () => {
mockFetch.mockResolvedValue(
new Response(JSON.stringify(sampleContainersResponse), {
@@ -267,4 +305,16 @@ describe("WudIntegration testing endpoint", () => {
const expected = `Basic ${Buffer.from(`${TEST_USERNAME}:${TEST_PASSWORD}`).toString("base64")}`;
expect(headers.Authorization).toBe(expected);
});
+
+ test("passes the Bearer auth header through to fetchAsync when configured", async () => {
+ const response = new Response(JSON.stringify(sampleContainersResponse), { status: 200 });
+ const input = makeInput(response);
+
+ await invokeTesting(createIntegrationWithPersonalAccessToken(), input);
+
+ const fetchAsyncMock = vi.mocked(input.fetchAsync);
+ const init = fetchAsyncMock.mock.calls[0]?.[1];
+ const headers = (init?.headers ?? {}) as Record<string, string>;
+ expect(headers.Authorization).toBe(`Bearer ${TEST_PERSONAL_ACCESS_TOKEN}`);
+ });
});
diff --git a/packages/integrations/src/wud/wud-integration.ts b/packages/integrations/src/wud/wud-integration.ts
index 05c6cc17a..470fddfd6 100644
--- a/packages/integrations/src/wud/wud-integration.ts
+++ b/packages/integrations/src/wud/wud-integration.ts
@@ -51,6 +51,10 @@ export class WudIntegration extends Integration {
}
private getAuthHeaders(): Record<string, string> | undefined {
+ if (this.hasSecretValue("personalAccessToken")) {
+ return { Authorization: `Bearer ${this.getSecretValue("personalAccessToken")}` };
+ }
+
if (!this.hasSecretValue("username") || !this.hasSecretValue("password")) {
return undefined;
}