#1782·planka

[v2.2.1] Valid access token rejected on every authenticated endpoint — login returns 200 and session persists correctly (E_UNAUTHORIZED loop)

Author: ronaldchiquitelliCreated Sep 21, 2026Updated Sep 21, 2026

Description

On v2.2.1, login succeeds and the session is persisted correctly, but every authenticated endpoint returns 401 E_UNAUTHORIZED ("Access token is missing, invalid or expired") — both in the web UI (infinite redirect back to /login) and via direct API calls with the exact Authorization: Bearer <JWT> header.

Rolling back to 2.1.0 resolves the issue (the same login flow works).

Evidence collected (single-container deployment, single Postgres)

Verified with the exact token/pair issued by a fresh login:

  1. JWT signature is valid: jwt.verify(token, process.env.SECRET_KEY) succeeds (also confirmed the server signs with sails.config.session.secret = SECRET_KEY).
  2. The session row matches the issued token byte-by-byte: md5(session.access_token) == md5(token_from_response_body), correct created_at.
  3. http_only_token matches the cookie sent by the client (captured via Playwright: Cookie: httpOnlyToken=<uuid> + Authorization: Bearer <JWT> on the same request).
  4. user_account.id == jwt.sub, is_deactivated = false, password_changed_at IS NULL (so the passwordChangedAt > issuedAt check cannot trigger).
  5. The login response itself is 200 with the expected item (a 1-year JWT, not a pending token — terms/TOTP steps are not required), and the httpOnlyToken cookie is set.

Despite all of the above, GET /api/users/me (and every other authenticated route) returns:

json
{"code":"E_UNAUTHORIZED","message":"Access token is missing, invalid or expired"}

Tested both from the browser (frontend flow, withHttpOnlyToken=true) and from inside the container against http://localhost:1337 — same result.

Note: x-api-key authentication works (API-key users are unaffected).

Environment

  • Image: ghcr.io/plankanban/planka:latest (= v2.2.1)
  • Node v22.22.1, PostgreSQL 16 (separate container)
  • BASE_URL, TRUST_PROXY=1, SECRET_KEY set via env

Expected

A session created by POST /api/access-tokens should authenticate subsequent requests via Authorization: Bearer.

Actual

Every authenticated endpoint returns 401 until rollback to 2.1.0.

Happy to provide additional dumps/logs if useful.