From 43990c7e56c2dad0db0f7ce350bbd9b9eca87de9 Mon Sep 17 00:00:00 2001
From: Plateau Nguyen
Date: Fri, 20 Mar 2026 06:54:11 +0700
Subject: [PATCH] Fix ChatGPT OAuth setup wizard flow (#289)
---
ui/web/src/i18n/locales/en/setup.json | 2 +
ui/web/src/i18n/locales/vi/setup.json | 2 +
.../providers/provider-oauth-section.tsx | 20 ++++--
ui/web/src/pages/setup/step-provider.tsx | 62 +++++++++++++++----
4 files changed, 69 insertions(+), 17 deletions(-)
diff --git a/ui/web/src/i18n/locales/en/setup.json b/ui/web/src/i18n/locales/en/setup.json
index 593f3fa9..2f69b663 100644
--- a/ui/web/src/i18n/locales/en/setup.json
+++ b/ui/web/src/i18n/locales/en/setup.json
@@ -18,6 +18,7 @@
"provider": {
"title": "Configure LLM Provider",
"descriptionCli": "Connect using your local Claude CLI installation. No API key needed.",
+ "descriptionOauth": "Sign in with your ChatGPT account to use your subscription through OAuth. No API key needed.",
"description": "Connect to an AI provider to power your agents. You'll need an API key.",
"providerType": "Provider Type",
"providerTypeHint": "The LLM service you want to connect. OpenRouter is recommended for access to multiple models.",
@@ -31,6 +32,7 @@
"create": "Create Provider",
"errors": {
"apiKeyRequired": "API key is required",
+ "oauthProviderNotFound": "OAuth authentication succeeded, but the provider could not be found. Please try again.",
"failedCreate": "Failed to create provider"
}
},
diff --git a/ui/web/src/i18n/locales/vi/setup.json b/ui/web/src/i18n/locales/vi/setup.json
index a2063cdd..dd1fd101 100644
--- a/ui/web/src/i18n/locales/vi/setup.json
+++ b/ui/web/src/i18n/locales/vi/setup.json
@@ -18,6 +18,7 @@
"provider": {
"title": "Cấu hình provider LLM",
"descriptionCli": "Kết nối bằng Claude CLI cục bộ. Không cần API key.",
+ "descriptionOauth": "Đăng nhập bằng tài khoản ChatGPT để dùng gói thuê bao qua OAuth. Không cần API key.",
"description": "Kết nối với provider AI để cấp nguồn cho agent. Bạn cần có API key.",
"providerType": "Loại provider",
"providerTypeHint": "Dịch vụ LLM bạn muốn kết nối. Khuyến nghị dùng OpenRouter để truy cập nhiều model.",
@@ -31,6 +32,7 @@
"create": "Tạo provider",
"errors": {
"apiKeyRequired": "API key là bắt buộc",
+ "oauthProviderNotFound": "Xác thực OAuth thành công nhưng không tìm thấy provider. Vui lòng thử lại.",
"failedCreate": "Không thể tạo provider"
}
},
diff --git a/ui/web/src/pages/providers/provider-oauth-section.tsx b/ui/web/src/pages/providers/provider-oauth-section.tsx
index f42d50fc..eab82048 100644
--- a/ui/web/src/pages/providers/provider-oauth-section.tsx
+++ b/ui/web/src/pages/providers/provider-oauth-section.tsx
@@ -18,7 +18,12 @@ interface StartResponse {
status?: string;
}
-export function OAuthSection({ onSuccess }: { onSuccess: () => void }) {
+interface OAuthSectionProps {
+ onSuccess: () => void;
+ authenticatedActionLabel?: string;
+}
+
+export function OAuthSection({ onSuccess, authenticatedActionLabel }: OAuthSectionProps) {
const { t } = useTranslation("providers");
const http = useHttp();
const [status, setStatus] = useState(null);
@@ -176,9 +181,16 @@ export function OAuthSection({ onSuccess }: { onSuccess: () => void }) {
{t("oauth.modelPrefixHint")} openai-codex/{" "}
{t("oauth.modelPrefixExample")}