fix(dashboard): show no-auth card for free providers instead of OAuth modal

OpenCode Free (noAuth: true) was routed through OAuthModal which tried to call
a non-existent /api/oauth/opencode/authorize endpoint, resulting in a 500 error.

Detect noAuth free providers via FREE_PROVIDERS[id]?.noAuth and render a
NoAuthProviderCard (lock_open + description) instead of the connections section
with the "+ Add" button that triggered the broken flow.
This commit is contained in:
diegosouzapw
2026-05-16 21:05:49 -03:00
parent 08f03a0fa6
commit fd28e772a8
3 changed files with 27 additions and 1 deletions

View File

@@ -19,9 +19,11 @@ import {
Toggle,
Select,
ProxyConfigModal,
NoAuthProviderCard,
} from "@/shared/components";
import {
LOCAL_PROVIDERS,
FREE_PROVIDERS,
getProviderAlias,
isOpenAICompatibleProvider,
isAnthropicCompatibleProvider,
@@ -1084,6 +1086,7 @@ export default function ProviderDetailPage() {
providerInfo?.toggleAuthType === "oauth" || providerInfo?.toggleAuthType === "free";
const providerSupportsPat = supportsApiKeyOnFreeProvider(providerId);
const isOAuth = providerSupportsOAuth && !providerSupportsPat;
const isFreeNoAuth = FREE_PROVIDERS[providerId]?.noAuth === true;
const registryModels = getModelsByProviderId(providerId);
// Prefer synced API-discovered models when available, then merge built-ins
// and user-managed custom models without duplicating IDs.
@@ -3167,7 +3170,8 @@ export default function ProviderDetailPage() {
)}
{/* Connections */}
{!isUpstreamProxyProvider && (
{!isUpstreamProxyProvider && isFreeNoAuth && <NoAuthProviderCard />}
{!isUpstreamProxyProvider && !isFreeNoAuth && (
<Card>
<div className="mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
<div className="flex min-w-0 flex-wrap items-center gap-2">

View File

@@ -0,0 +1,21 @@
"use client";
import Card from "./Card";
export default function NoAuthProviderCard() {
return (
<Card>
<div className="flex items-center gap-3">
<div className="inline-flex shrink-0 items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500">
<span className="material-symbols-outlined text-[20px]">lock_open</span>
</div>
<div className="flex-1">
<p className="text-sm font-medium">No authentication required</p>
<p className="text-xs text-text-muted">
This provider is ready to use immediately no signup or API key needed.
</p>
</div>
</div>
</Card>
);
}

View File

@@ -32,6 +32,7 @@ export { default as NotificationToast } from "./NotificationToast";
export { default as FilterBar } from "./FilterBar";
export { default as ColumnToggle } from "./ColumnToggle";
export { default as DataTable } from "./DataTable";
export { default as NoAuthProviderCard } from "./NoAuthProviderCard";
// Layouts
export * from "./layouts";