Skip to content

API Error: 400 bad request: Authorization header is badly formatted #1867

@LittleSakura77

Description

@LittleSakura77

Self Checks / 自检

CC Switch Version / 版本号

版本 v3.12.3

Operating System / 操作系统

Windows

Related App / 涉及应用

Claude Code

Steps to Reproduce / 重现步骤

使用 cc-switch 接入 GitHub Copilot 订阅模型给 claude code使用时,出现以下错误:
API Error: 400 bad request: Authorization header is badly formatted

环境信息

  • cc-switch 版本:v3.12.3
  • 操作系统:Windows
  • 代理端口:127.0.0.1:15721

已确认的情况

  1. ✅ GitHub Copilot 账号已登录(LittleSakura77)
  2. ✅ Copilot Token 未过期
  3. ✅ 代理服务正常运行
  4. ❌ 仍然出现 Authorization header 格式错误

日志信息

从 cc-switch 日志中看到代理有请求被拒绝:
rejection_type="axum::extract::rejection::MissingJsonContentType"

配置文件

providers 表中 GitHub Copilot 配置:

{
  "accounts": {
    "68846244": {
      "github_token": "ghu_xxx..."
    }
  }
}

### Expected Behavior / 期望行为

请问这个问题如何解决?或者是否有其他排查方式?
感谢!

### Actual Behavior / 实际行为

_No response_

### Additional Context / 补充信息

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions