[v2.2.1] Valid access token rejected on every authenticated endpoint — login returns 200 and session persists correctly (E_UNAUTHORIZED loop)
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:
- JWT signature is valid:
jwt.verify(token, process.env.SECRET_KEY)succeeds (also confirmed the server signs withsails.config.session.secret=SECRET_KEY). - The session row matches the issued token byte-by-byte:
md5(session.access_token) == md5(token_from_response_body), correctcreated_at. http_only_tokenmatches the cookie sent by the client (captured via Playwright:Cookie: httpOnlyToken=<uuid>+Authorization: Bearer <JWT>on the same request).user_account.id == jwt.sub,is_deactivated = false,password_changed_at IS NULL(so thepasswordChangedAt > issuedAtcheck cannot trigger).- The login response itself is
200with the expecteditem(a 1-year JWT, not a pending token — terms/TOTP steps are not required), and thehttpOnlyTokencookie is set.
Despite all of the above, GET /api/users/me (and every other authenticated route) returns:
{"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_KEYset 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.
Source: plankanban/planka