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(homebox): support API key authentication (#7237)

Thomas0f4c3ec9ae97
diff --git a/apps/docs/docs/integrations/homebox/index.mdx b/apps/docs/docs/integrations/homebox/index.mdx
index d4353a95b..fa39eac13 100644
--- a/apps/docs/docs/integrations/homebox/index.mdx
+++ b/apps/docs/docs/integrations/homebox/index.mdx
@@ -27,7 +27,7 @@ The default Homebox port is `7745`.
### Secrets
-Homebox requires the username (email address) and password of a Homebox account. Homarr authenticates for each stats fetch and does not retain the session token between fetches.
+Homebox accepts an API key or an account's email address and password. Use an API key for OIDC-only accounts.
<IntegrationSecrets
secrets={[
@@ -38,5 +38,9 @@ Homebox requires the username (email address) and password of a Homebox account.
"Enter that account's password in the Password field when creating the integration in Homarr.",
],
},
+ {
+ credentials: ["apiKey"],
+ steps: ["Create an API key in Homebox for this integration."],
+ },
]}
/>
diff --git a/packages/definitions/src/integration.ts b/packages/definitions/src/integration.ts
index fe7aab5a7..a7ad3a8a8 100644
--- a/packages/definitions/src/integration.ts
+++ b/packages/definitions/src/integration.ts
@@ -176,7 +176,7 @@ export const integrationDefs = {
homebox: {
httpAuth: { type: "adapter" },
name: "Homebox",
- secretKinds: [["username", "password"]],
+ secretKinds: [["username", "password"], ["apiKey"]],
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/homebox.svg",
category: ["miscellaneous"],
documentationSlug: "homebox",
diff --git a/packages/integrations/src/stats/providers/homebox.ts b/packages/integrations/src/stats/providers/homebox.ts
index 3caf30a3d..707a1e7df 100644
--- a/packages/integrations/src/stats/providers/homebox.ts
+++ b/packages/integrations/src/stats/providers/homebox.ts
@@ -58,6 +58,11 @@ export const homeboxStatsProvider = {
} satisfies StatsProvider;
async function getHttpAuthenticationAsync(context: StatsFetchContext) {
+ if (context.hasSecret("apiKey")) {
+ const apiKey = context.secret("apiKey");
+ return { headers: { Authorization: `Bearer ${apiKey}` }, redactValues: [apiKey] };
+ }
+
try {
const loginResponse = await context.requestAsync("/api/v1/users/login", {
method: "POST",