Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

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

Offen
#10,352 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@umeraamir69 arbeitet bereits daran.

Seit 22.10.2026.

  • #10358 von @umeraamir69 — offen

Bewertung

Schwierigkeit
1/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
25/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
node.js, typescript
Bereich
api, authentication

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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
Vorherrschende Sprache
TypeScript
Sterne
1.8k
Forks
483
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
325

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus clerk/javascript

Alle Issues in clerk/javascript

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.