Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#10,352 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@umeraamir69 đang làm issue này rồi.

Từ ngày 22/10/2026.

  • #10358 của @umeraamir69 — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
node.js, typescript
Lĩnh vực
api, authentication

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
TypeScript
Star
1.8k
Fork
483
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
325

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của clerk/javascript

Tất cả issue của clerk/javascript

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.