From 44c7b3483765125ec4f9681ec8d1281eaceb0d0c Mon Sep 17 00:00:00 2001 From: decolua Date: Wed, 29 Jul 2026 19:27:31 +0700 Subject: [PATCH] fix(ui): count dual-auth provider cards correctly Share oauth+apikey/api_key stats for dual-auth providers (incl. kiro) so card totals match the detail page. --- .../(dashboard)/dashboard/providers/page.js | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/src/app/(dashboard)/dashboard/providers/page.js b/src/app/(dashboard)/dashboard/providers/page.js index 61461726..2fa34f66 100644 --- a/src/app/(dashboard)/dashboard/providers/page.js +++ b/src/app/(dashboard)/dashboard/providers/page.js @@ -277,6 +277,16 @@ export default function ProvidersPage() { })) .filter((p) => matchSearch(p.name)); + // Dual-auth providers (oauth + apikey) store API keys as authType "apikey" + // (and sometimes "api_key"). Card stats must count both so totals match detail. + // kiro has no authModes in registry but accepts both (headless uses "api_key"). + const dualAuthTypes = (info, key) => { + if (key === "kiro") return ["oauth", "apikey", "api_key"]; + const modes = info?.authModes; + if (!Array.isArray(modes) || !modes.includes("apikey")) return "oauth"; + return ["oauth", "apikey", "api_key"]; + }; + const oauthEntries = sortByPriority( Object.entries(OAUTH_PROVIDERS).filter(([, info]) => !info.hidden && matchSearch(info.name)), "oauth", @@ -424,16 +434,19 @@ export default function ProvidersPage() {
- {oauthEntries.map(([key, info]) => ( - handleToggleProvider(key, "oauth", active)} - /> - ))} + {oauthEntries.map(([key, info]) => { + const authTypes = dualAuthTypes(info, key); + return ( + handleToggleProvider(key, authTypes, active)} + /> + ); + })}
)} @@ -466,12 +479,9 @@ export default function ProvidersPage() {
{freeEntries.map(([key, info]) => { - // Kiro accepts both OAuth and api-key connections; count/toggle both - // so the card total matches the provider detail page (#kiro-apikey). - // Kiro's headless api-key flow persists authType "api_key" (underscore), - // while generic apikey providers use "apikey" — include both spellings. - const freeAuthTypes = - key === "kiro" ? ["oauth", "apikey", "api_key"] : "oauth"; + // Dual-auth (e.g. kiro): count/toggle oauth + apikey/api_key so the + // card total matches the provider detail page. + const freeAuthTypes = dualAuthTypes(info, key); return (