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
- Create an account-owned API token (for example with Zone:Read, DNS:Edit).
GET https://[HOST-1]/client/v4/accounts/<id>/tokens/verifywith it returnssuccess: true, status: active.GET https://[HOST-1]/client/v4/user/tokens/verifywith the same token returnssuccess: false,code 1000.- Run any
@swamp/cloudflare/*model method withapiTokenset to that token: it fails withCloudflare 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
Open
No activity in this phase yet.
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.