Skip to content

修复添加 API Key 后被强制退出登录的问题#45

Open
T1mn wants to merge 1 commit intoTQZHR:mainfrom
T1mn:main
Open

修复添加 API Key 后被强制退出登录的问题#45
T1mn wants to merge 1 commit intoTQZHR:mainfrom
T1mn:main

Conversation

@T1mn
Copy link

@T1mn T1mn commented Mar 6, 2026

问题

Issue #38

添加 API Key 后,管理后台会自动退出登录,无法保持登录状态。

原因

每次 API 操作都会重新请求登录接口获取 token,遇到 401 错误时直接清除登录状态并跳转到登录页。

修复

  1. ensureApiKey() 中添加缓存机制,避免重复请求
  2. 遇到 401 时先刷新 token 重试一次,而不是直接退出
  3. 只有刷新失败才真正执行 logout

测试

  • 添加 API Key 不再退出登录
  • 编辑/删除 API Key 保持登录状态
  • 真正的认证失败仍会正常退出

Add token caching and 401 retry logic to fix issue where users are
logged out when adding/editing API keys. Cache api_key in ensureApiKey()
and retry once with forceRefresh on 401 errors before logout.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Pegasus02 pushed a commit to Pegasus02/grok2api that referenced this pull request Mar 22, 2026
…rok-superimage-1.0-pg7sej

Add grok-superimage model with server-side image config, improve SSE error handling and transient retry logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants