Local dev frontend cannot connect: all interactive /api routes 401 even with valid login token

Open
#227 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start in backend/src/router.ts, focusing on the session middleware, docs-domain authorization, and resolveInteractiveActor flow described in the issue. Run make dev and reproduce the login and authenticated requests against /api/operating-model and /api/tasks; done means valid Bearer-token requests return their expected successful responses instead of 401.

Written by the indexing model from the issue text.

Description

backend bug needs grooming

Raw intake from local dev session (2026-09-10).

Symptom: the Vite frontend on :3002 loads, but every data call fails. Backend log shows repeated 4xx on the operating_model route family; curl confirms GET /api/operating-model and /api/tasks return 401, with and without a valid Bearer token from POST /api/auth/login.

Suspected area: backend/src/router.ts session middleware is skipped whenever the docs-domain portal layer authorizes the request, but with browser auth unconfigured (local dev) the portal authorizes with no identity, so no x-user-id is ever set and bearer sessions are never validated downstream. resolveInteractiveActor then fails closed with 401.

Repro:

  1. make dev (frontend :3002, backend :3001)
  2. curl -X POST :3002/api/auth/login -d '{"email":"alexey@datatalks.club","password":"111"}' -> 200 + token
  3. curl :3002/api/operating-model -H "Authorization: Bearer " -> 401 (expected 200)
  4. curl ':3002/api/tasks?date=2026-09-10' -H "Authorization: Bearer " -> 401 (expected 200)
Dominant language
TypeScript
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DataTalksClub/dataops

All issues in DataTalksClub/dataops

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.