Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

API key verification forwards client User-Agent, causing Python urllib requests to fail

未关闭
#10,352 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@umeraamir69 已经在做这个了。

开始于 2026年10月22日。

  • #10358 来自 @umeraamir69 —— 未关闭

评估

难度
1/5
预计耗时
1-3 小时
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞

调研方向

The report names verifyAPIKey() and createBackendApiClient(options) in @clerk/backend, and includes a reproduction repository with an npm run repro script. Read the verification path and compare the outbound request's User-Agent with the incoming request; run the reproduction with both User-Agent values. Done when both requests authenticate successfully with the same credentials. An open linked pull request (#10358) indicates work is already underway.

由索引模型根据 Issue 内容生成。

描述

needs-triage
Preliminary Checks
Reproduction

https://github.com/jandorn/clerk-api-key-user-agent-repro

Publishable key

pk_live_Y2xlcmsudGVsZXNjb3BlLmVuZXJneSQ

Description

Steps to reproduce:

  1. Clone the reproduction repository and run npm ci.
  2. Copy .env.example to .env and configure credentials from the same Clerk instance, including a valid API key.
  3. Run npm run repro.

The script uses unpatched @clerk/[email protected] and calls authenticateRequest(request, { acceptsToken: 'api_key' }) twice with the same credentials. Only the incoming User-Agent changes.

Expected behavior:
Both requests authenticate successfully.

Actual behavior:

  • Python-urllib/3.11 → upstream HTTP 403 (text/html), isAuthenticated: false, reason: unexpected-error.
  • clerk-api-key-repro/1.0 → upstream HTTP 200 (application/json), isAuthenticated: true.

The full live output is included in the reproduction README.

Suspected cause:
verifyAPIKey() passes the authentication context to createBackendApiClient(options). The context's incoming userAgent overrides the SDK's default User-Agent.

Using the SDK User-Agent for this outbound request resolved the issue in our application:

const client = createBackendApiClient({ ...options, userAgent: USER_AGENT });
Environment
System:
    OS: macOS 27.0.1
    CPU: (15) arm64 Apple M5 Pro
    Memory: 75.17 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 23.11.0 - /opt/homebrew/bin/node
    npm: 11.19.1 - /opt/homebrew/bin/npm
    pnpm: 10.11.0 - /opt/homebrew/bin/pnpm
    bun: 1.3.9 - /Users/jandorn/.bun/bin/bun
  Browsers:
    Chrome: 155.0.8059.85
    Firefox: 144.0.2
    Safari: 27.0.1
  npmPackages:
    @clerk/backend: 3.2.2 => 3.2.2
主要语言
TypeScript
星标
1.8k
派生
483
平均合并
1 天 23 小时
30 天内合并 PR
325

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

clerk/javascript 的其他 Issue

查看 clerk/javascript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。