Skip to content

Commit 74badca

Browse files
fix(oauth): remove iflow cookie login
1 parent 70a12bb commit 74badca

5 files changed

Lines changed: 2 additions & 190 deletions

File tree

src/i18n/locales/en.json

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -913,23 +913,6 @@
913913
"iflow_oauth_status_error": "Authentication failed:",
914914
"iflow_oauth_start_error": "Failed to start iFlow OAuth:",
915915
"iflow_oauth_polling_error": "Failed to check authentication status:",
916-
"iflow_cookie_title": "iFlow Cookie Login",
917-
"iflow_cookie_label": "Cookie Value:",
918-
"iflow_cookie_placeholder": "Enter the BXAuth value, starting with BXAuth=",
919-
"iflow_cookie_hint": "Submit an existing cookie to finish login without opening the authorization link; the credential file will be saved automatically.",
920-
"iflow_cookie_key_hint": "Note: Create a key on the platform first.",
921-
"iflow_cookie_button": "Submit Cookie Login",
922-
"iflow_cookie_status_success": "Cookie login succeeded and credentials are saved.",
923-
"iflow_cookie_status_error": "Cookie login failed:",
924-
"iflow_cookie_status_duplicate": "Duplicate config:",
925-
"iflow_cookie_start_error": "Failed to submit cookie login:",
926-
"iflow_cookie_config_duplicate": "A config file already exists (duplicate). Remove the existing file and try again if you want to re-save it.",
927-
"iflow_cookie_required": "Please provide the Cookie value first.",
928-
"iflow_cookie_result_title": "Cookie Login Result",
929-
"iflow_cookie_result_email": "Account",
930-
"iflow_cookie_result_expired": "Expires At",
931-
"iflow_cookie_result_path": "Saved Path",
932-
"iflow_cookie_result_type": "Type",
933916
"remote_access_disabled": "This login method is not available for remote access. Please access from localhost."
934917
},
935918
"usage_stats": {

src/i18n/locales/ru.json

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -910,23 +910,6 @@
910910
"iflow_oauth_status_error": "Ошибка аутентификации:",
911911
"iflow_oauth_start_error": "Не удалось запустить iFlow OAuth:",
912912
"iflow_oauth_polling_error": "Не удалось проверить статус аутентификации:",
913-
"iflow_cookie_title": "Вход iFlow по cookie",
914-
"iflow_cookie_label": "Значение cookie:",
915-
"iflow_cookie_placeholder": "Введите значение BXAuth, начиная с BXAuth=",
916-
"iflow_cookie_hint": "Отправьте существующий cookie, чтобы завершить вход без открытия ссылки авторизации; файл учётных данных будет сохранён автоматически.",
917-
"iflow_cookie_key_hint": "Примечание: сначала создайте ключ на платформе.",
918-
"iflow_cookie_button": "Отправить вход по cookie",
919-
"iflow_cookie_status_success": "Вход по cookie выполнен, учётные данные сохранены.",
920-
"iflow_cookie_status_error": "Ошибка входа по cookie:",
921-
"iflow_cookie_status_duplicate": "Дублирующая конфигурация:",
922-
"iflow_cookie_start_error": "Не удалось отправить вход по cookie:",
923-
"iflow_cookie_config_duplicate": "Такая конфигурация уже существует. Удалите файл и повторите, если хотите перезаписать.",
924-
"iflow_cookie_required": "Сначала укажите значение cookie.",
925-
"iflow_cookie_result_title": "Результат входа по cookie",
926-
"iflow_cookie_result_email": "Аккаунт",
927-
"iflow_cookie_result_expired": "Истекает",
928-
"iflow_cookie_result_path": "Путь сохранения",
929-
"iflow_cookie_result_type": "Тип",
930913
"remote_access_disabled": "Этот способ входа недоступен при удалённом доступе. Подключитесь с localhost."
931914
},
932915
"usage_stats": {

src/i18n/locales/zh-CN.json

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -913,23 +913,6 @@
913913
"iflow_oauth_status_error": "认证失败:",
914914
"iflow_oauth_start_error": "启动 iFlow OAuth 失败:",
915915
"iflow_oauth_polling_error": "检查认证状态失败:",
916-
"iflow_cookie_title": "iFlow Cookie 登录",
917-
"iflow_cookie_label": "Cookie 内容:",
918-
"iflow_cookie_placeholder": "填入BXAuth值 以BXAuth=开头",
919-
"iflow_cookie_hint": "直接提交 Cookie 以完成登录(无需打开授权链接),服务端将自动保存凭据。",
920-
"iflow_cookie_key_hint": "提示:需在平台上先创建 Key。",
921-
"iflow_cookie_button": "提交 Cookie 登录",
922-
"iflow_cookie_status_success": "Cookie 登录成功,凭据已保存。",
923-
"iflow_cookie_status_error": "Cookie 登录失败:",
924-
"iflow_cookie_status_duplicate": "配置文件重复:",
925-
"iflow_cookie_start_error": "提交 Cookie 登录失败:",
926-
"iflow_cookie_config_duplicate": "检测到配置文件已存在(重复),如需重新保存请先删除原文件后重试。",
927-
"iflow_cookie_required": "请先填写 Cookie 内容",
928-
"iflow_cookie_result_title": "Cookie 登录结果",
929-
"iflow_cookie_result_email": "账号",
930-
"iflow_cookie_result_expired": "过期时间",
931-
"iflow_cookie_result_path": "保存路径",
932-
"iflow_cookie_result_type": "类型",
933916
"remote_access_disabled": "远程访问不支持此登录方式,请从本地 (localhost) 访问"
934917
},
935918
"usage_stats": {

src/pages/OAuthPage.tsx

Lines changed: 1 addition & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Card } from '@/components/ui/Card';
44
import { Button } from '@/components/ui/Button';
55
import { Input } from '@/components/ui/Input';
66
import { useNotificationStore, useThemeStore } from '@/stores';
7-
import { oauthApi, type OAuthProvider, type IFlowCookieAuthResponse } from '@/services/api/oauth';
7+
import { oauthApi, type OAuthProvider } from '@/services/api/oauth';
88
import { vertexApi, type VertexImportResponse } from '@/services/api/vertex';
99
import { copyToClipboard } from '@/utils/clipboard';
1010
import styles from './OAuthPage.module.scss';
@@ -14,7 +14,6 @@ import iconAntigravity from '@/assets/icons/antigravity.svg';
1414
import iconGemini from '@/assets/icons/gemini.svg';
1515
import iconKimiLight from '@/assets/icons/kimi-light.svg';
1616
import iconKimiDark from '@/assets/icons/kimi-dark.svg';
17-
import iconIflow from '@/assets/icons/iflow.svg';
1817
import iconVertex from '@/assets/icons/vertex.svg';
1918

2019
interface ProviderState {
@@ -31,14 +30,6 @@ interface ProviderState {
3130
callbackError?: string;
3231
}
3332

34-
interface IFlowCookieState {
35-
cookie: string;
36-
loading: boolean;
37-
result?: IFlowCookieAuthResponse;
38-
error?: string;
39-
errorType?: 'error' | 'warning';
40-
}
41-
4233
interface VertexImportResult {
4334
projectId?: string;
4435
email?: string;
@@ -92,7 +83,6 @@ export function OAuthPage() {
9283
const { showNotification } = useNotificationStore();
9384
const resolvedTheme = useThemeStore((state) => state.resolvedTheme);
9485
const [states, setStates] = useState<Record<OAuthProvider, ProviderState>>({} as Record<OAuthProvider, ProviderState>);
95-
const [iflowCookie, setIflowCookie] = useState<IFlowCookieState>({ cookie: '', loading: false });
9686
const [vertexState, setVertexState] = useState<VertexImportState>({
9787
fileName: '',
9888
location: '',
@@ -233,49 +223,6 @@ export function OAuthPage() {
233223
}
234224
};
235225

236-
const submitIflowCookie = async () => {
237-
const cookie = iflowCookie.cookie.trim();
238-
if (!cookie) {
239-
showNotification(t('auth_login.iflow_cookie_required'), 'warning');
240-
return;
241-
}
242-
setIflowCookie((prev) => ({
243-
...prev,
244-
loading: true,
245-
error: undefined,
246-
errorType: undefined,
247-
result: undefined
248-
}));
249-
try {
250-
const res = await oauthApi.iflowCookieAuth(cookie);
251-
if (res.status === 'ok') {
252-
setIflowCookie((prev) => ({ ...prev, loading: false, result: res }));
253-
showNotification(t('auth_login.iflow_cookie_status_success'), 'success');
254-
} else {
255-
setIflowCookie((prev) => ({
256-
...prev,
257-
loading: false,
258-
error: res.error,
259-
errorType: 'error'
260-
}));
261-
showNotification(`${t('auth_login.iflow_cookie_status_error')} ${res.error || ''}`, 'error');
262-
}
263-
} catch (err: unknown) {
264-
if (getErrorStatus(err) === 409) {
265-
const message = t('auth_login.iflow_cookie_config_duplicate');
266-
setIflowCookie((prev) => ({ ...prev, loading: false, error: message, errorType: 'warning' }));
267-
showNotification(message, 'warning');
268-
return;
269-
}
270-
const message = getErrorMessage(err);
271-
setIflowCookie((prev) => ({ ...prev, loading: false, error: message, errorType: 'error' }));
272-
showNotification(
273-
`${t('auth_login.iflow_cookie_start_error')}${message ? ` ${message}` : ''}`,
274-
'error'
275-
);
276-
}
277-
};
278-
279226
const handleVertexFilePick = () => {
280227
vertexFileInputRef.current?.click();
281228
};
@@ -540,77 +487,6 @@ export function OAuthPage() {
540487
)}
541488
</div>
542489
</Card>
543-
544-
{/* iFlow Cookie 登录 */}
545-
<Card
546-
title={
547-
<span className={styles.cardTitle}>
548-
<img src={iconIflow} alt="" className={styles.cardTitleIcon} />
549-
{t('auth_login.iflow_cookie_title')}
550-
</span>
551-
}
552-
extra={
553-
<Button onClick={submitIflowCookie} loading={iflowCookie.loading}>
554-
{t('auth_login.iflow_cookie_button')}
555-
</Button>
556-
}
557-
>
558-
<div className={styles.cardContent}>
559-
<div className={styles.cardHint}>{t('auth_login.iflow_cookie_hint')}</div>
560-
<div className={styles.cardHintSecondary}>
561-
{t('auth_login.iflow_cookie_key_hint')}
562-
</div>
563-
<div className={styles.formItem}>
564-
<label className={styles.formItemLabel}>{t('auth_login.iflow_cookie_label')}</label>
565-
<Input
566-
value={iflowCookie.cookie}
567-
onChange={(e) => setIflowCookie((prev) => ({ ...prev, cookie: e.target.value }))}
568-
placeholder={t('auth_login.iflow_cookie_placeholder')}
569-
/>
570-
</div>
571-
{iflowCookie.error && (
572-
<div
573-
className={`status-badge ${iflowCookie.errorType === 'warning' ? 'warning' : 'error'}`}
574-
>
575-
{iflowCookie.errorType === 'warning'
576-
? t('auth_login.iflow_cookie_status_duplicate')
577-
: t('auth_login.iflow_cookie_status_error')}{' '}
578-
{iflowCookie.error}
579-
</div>
580-
)}
581-
{iflowCookie.result && iflowCookie.result.status === 'ok' && (
582-
<div className={styles.connectionBox}>
583-
<div className={styles.connectionLabel}>{t('auth_login.iflow_cookie_result_title')}</div>
584-
<div className={styles.keyValueList}>
585-
{iflowCookie.result.email && (
586-
<div className={styles.keyValueItem}>
587-
<span className={styles.keyValueKey}>{t('auth_login.iflow_cookie_result_email')}</span>
588-
<span className={styles.keyValueValue}>{iflowCookie.result.email}</span>
589-
</div>
590-
)}
591-
{iflowCookie.result.expired && (
592-
<div className={styles.keyValueItem}>
593-
<span className={styles.keyValueKey}>{t('auth_login.iflow_cookie_result_expired')}</span>
594-
<span className={styles.keyValueValue}>{iflowCookie.result.expired}</span>
595-
</div>
596-
)}
597-
{iflowCookie.result.saved_path && (
598-
<div className={styles.keyValueItem}>
599-
<span className={styles.keyValueKey}>{t('auth_login.iflow_cookie_result_path')}</span>
600-
<span className={styles.keyValueValue}>{iflowCookie.result.saved_path}</span>
601-
</div>
602-
)}
603-
{iflowCookie.result.type && (
604-
<div className={styles.keyValueItem}>
605-
<span className={styles.keyValueKey}>{t('auth_login.iflow_cookie_result_type')}</span>
606-
<span className={styles.keyValueValue}>{iflowCookie.result.type}</span>
607-
</div>
608-
)}
609-
</div>
610-
</div>
611-
)}
612-
</div>
613-
</Card>
614490
</div>
615491
</div>
616492
);

src/services/api/oauth.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@ export interface OAuthCallbackResponse {
2020
status: 'ok';
2121
}
2222

23-
export interface IFlowCookieAuthResponse {
24-
status: 'ok' | 'error';
25-
error?: string;
26-
saved_path?: string;
27-
email?: string;
28-
expired?: string;
29-
type?: string;
30-
}
31-
3223
const WEBUI_SUPPORTED: OAuthProvider[] = ['codex', 'anthropic', 'antigravity', 'gemini-cli'];
3324
const CALLBACK_PROVIDER_MAP: Partial<Record<OAuthProvider, string>> = {
3425
'gemini-cli': 'gemini'
@@ -59,9 +50,5 @@ export const oauthApi = {
5950
provider: callbackProvider,
6051
redirect_url: redirectUrl
6152
});
62-
},
63-
64-
/** iFlow cookie 认证 */
65-
iflowCookieAuth: (cookie: string) =>
66-
apiClient.post<IFlowCookieAuthResponse>('/iflow-auth-url', { cookie })
53+
}
6754
};

0 commit comments

Comments
 (0)