Skip to main content
← Back to list
01Issue
BugOpenSwamp CLIPublic
AssigneesNone

Relationships

#4430 SWAMP_SERVER_TOKEN does not authenticate with --server, while --token and SWAMP_SERVER_TOKEN_FILE do

Opened by skunk-ape · 11/5/2026

What happened

Against a local swamp serve --auth-mode token, a valid server token is refused when given through SWAMP_SERVER_TOKEN, and accepted when the same token is given through --token, --token-file or SWAMP_SERVER_TOKEN_FILE.

Reproduce

swamp access token mint reader --principal user:reader
swamp access grant create --subject user:reader --allow read --on 'data:*'
swamp serve --auth-mode token --admins user:admin --port 9427 --no-schedule

# With the token from `swamp access token reveal reader`, from another directory:
swamp data query true --server http://127.0.0.1:9427 --token <token> --json     # works
SWAMP_SERVER_TOKEN_FILE=<file holding the token> swamp data query true --server http://127.0.0.1:9427 --json     # works
SWAMP_SERVER_TOKEN=<token> swamp data query true --server http://127.0.0.1:9427 --json     # fails

The failure is:

"error": "Authentication failed — run: swamp auth server-login --server ws://127.0.0.1:9427/"

It also fails with SWAMP_SERVE_URL set in place of --server. SWAMP_SERVER_TOKEN_FILE and any other serve URL variables were unset for the failing runs, and there was no stored login for that URL.

Expected

swamp data query --help says --token overrides "stored credentials and SWAMP_SERVER_TOKEN", so the variable should authenticate the same token. If it is no longer meant to work, the help text needs changing.

Also affected

stagecraft's REFERENCE.md, in the section on the remote studio, lists SWAMP_SERVER_TOKEN as a credential its --server reads use, so it will need correcting if the variable is being retired.

Environment

swamp 20261104.025555.0-sha.dd659114, linux x86_64. Found while working on swamp-club #4376, which passes tokens with --token-file and does not depend on this.

02Bog Flow
◉OPEN○TRIAGED○IN PROGRESS○SHIPPED

Open

11/5/2026, 3:52:54 PM

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.