Skip to main content
← Back to list
01Issue
BugTriagedExtensionsPublicTeam
Assigneesstack72

Relationships

#3540 Cloudflare extensions reject account-owned API tokens: credential check uses /user/tokens/verify

Opened by randybias · 10/16/2026

Description

Every @swamp/cloudflare/* extension validates an API token with GET /user/tokens/verify before its first call (models/_lib/cloudflare.ts, getAuth()). Cloudflare account-owned API tokens (created under Manage Account → API Tokens, or via POST /accounts/{account_id}/tokens) always fail that endpoint with HTTP 401 and error 1000 Invalid API Token, even though they are valid and active. Cloudflare verifies them at GET /accounts/{account_id}/tokens/verify instead.

So any model run with an account-owned token fails in getAuth() before it reaches the API. That includes @swamp/cloudflare/tokens/tokens itself, whose endpoints are all /accounts/{account_id}/tokens, meaning an account token is the natural credential to manage account tokens with.

Steps to reproduce

  1. Create an account-owned API token (for example with Zone:Read, DNS:Edit).
  2. GET https://[HOST-1]/client/v4/accounts/<id>/tokens/verify with it returns success: true, status: active.
  3. GET https://[HOST-1]/client/v4/user/tokens/verify with the same token returns success: false, code 1000.
  4. Run any @swamp/cloudflare/* model method with apiToken set to that token: it fails with Cloudflare API token is invalid (GET /user/tokens/verify returned 401).

Suggested fix

If /user/tokens/verify returns 401 with code 1000 and an account ID is available (most models take account_id), retry /accounts/{account_id}/tokens/verify. Alternatively, skip the up-front verify and let the first real call report auth errors. The check lives in the shared _lib/cloudflare.ts, so the fix applies to every @swamp/cloudflare/* package (seen in tokens and dns, version 2026.10.13.1).

Environment

@swamp/cloudflare/tokens and @swamp/cloudflare/dns 2026.10.13.1, swamp 20261013.025835.0.

Upstream repository: https://github.com/swamp-club/swamp-extensions

Environment

  • Extension: @swamp/cloudflare/tokens@2026.10.13.1
  • swamp: 20261013.025835.0-sha.1b6f0c59
  • OS: darwin (aarch64)
  • Deno: 2.9.7
  • Shell: /bin/zsh
02Bog Flow
✓OPEN◉TRIAGED○IN PROGRESS○SHIPPED+ 1 MOREASSIGNEDCLASSIFICATION

Triaged

10/16/2026, 9:30:31 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack7210/16/2026, 9:29:22 PM
Editable. Press Enter to edit.

system commented 10/16/2026, 8:34:48 AM

Classified automatically when this issue was filed.

  • Source: Extensions

If you feel this classification is incorrect, add a ripple to tell us so.

Sign in to post a ripple.