[PR #195] [MERGED] fix(kiro): 修复批量导入请求缺少认证头的问题,出现401错误,已经回归验证。 #294

Closed
opened 2026-02-27 07:18:51 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/justlovemaki/AIClient-2-API/pull/195
Author: @leonaii
Created: 1/9/2026
Status: Merged
Merged: 1/9/2026
Merged by: @justlovemaki

Base: mainHead: main


📝 Commits (2)

  • 03940ed fix(kiro): 修复批量导入请求缺少认证头的问题,出现401错误
  • 7e5470c Merge branch 'justlovemaki:main' into main

📊 Changes

1 file changed (+2 additions, -2 deletions)

View changed files

📝 static/app/provider-manager.js (+2 -2)

📄 Description

问题描述

Kiro 批量导入 refreshToken 功能在启用 UI 认证的情况下会返回 401 Unauthorized 错误。

原因分析

批量导入功能使用原生 fetch API 发送 SSE 流式请求,但没有携带认证头信息,导致服务端认证失败。

解决方案

在 fetch 请求中添加认证头:

  • 优先使用 window.apiClient.getAuthHeaders() 获取完整的认证头
  • 当 apiClient 不可用时回退到默认的 Content-Type

修改的文件

文件 变更说明
static/app/provider-manager.js 在批量导入的 fetch 请求中添加认证头

代码变更

// Before
headers: {
    'Content-Type': 'application/json'
}

// After
headers: window.apiClient ? window.apiClient.getAuthHeaders() : {
    'Content-Type': 'application/json'
}

---

<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
## 📋 Pull Request Information **Original PR:** https://github.com/justlovemaki/AIClient-2-API/pull/195 **Author:** [@leonaii](https://github.com/leonaii) **Created:** 1/9/2026 **Status:** ✅ Merged **Merged:** 1/9/2026 **Merged by:** [@justlovemaki](https://github.com/justlovemaki) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (2) - [`03940ed`](https://github.com/justlovemaki/AIClient-2-API/commit/03940ed886ef12cd25dbd94fc9d97d57fdb0f66f) fix(kiro): 修复批量导入请求缺少认证头的问题,出现401错误 - [`7e5470c`](https://github.com/justlovemaki/AIClient-2-API/commit/7e5470c0428cddf6ff3c4469fe9484367123f614) Merge branch 'justlovemaki:main' into main ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `static/app/provider-manager.js` (+2 -2) </details> ### 📄 Description ## 问题描述 Kiro 批量导入 refreshToken 功能在启用 UI 认证的情况下会返回 401 Unauthorized 错误。 ## 原因分析 批量导入功能使用原生 `fetch` API 发送 SSE 流式请求,但没有携带认证头信息,导致服务端认证失败。 ## 解决方案 在 fetch 请求中添加认证头: - 优先使用 `window.apiClient.getAuthHeaders()` 获取完整的认证头 - 当 apiClient 不可用时回退到默认的 `Content-Type` 头 ## 修改的文件 | 文件 | 变更说明 | |------|----------| | `static/app/provider-manager.js` | 在批量导入的 fetch 请求中添加认证头 | ## 代码变更 ```javascript // Before headers: { 'Content-Type': 'application/json' } // After headers: window.apiClient ? window.apiClient.getAuthHeaders() : { 'Content-Type': 'application/json' } --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 07:18:51 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AIClient-2-API-justlovemaki#294
No description provided.