Skip to content

First-load 401 on api/v1/devices/stats when stale JWT exists in UI local storage #993

Description

@graikhel-intel

What Is Happening

When the UI is opened for the first time after a prior session, the dashboard immediately requests /api/v1/devices/stats.

In certain sessions, the browser still holds a stale authentication token in local storage. The application treats that persisted value as a valid signed in state and proceeds with protected requests before token validity is re established.

As a result, the statistics request is sent with an invalid or expired bearer token, and the server responds with 401 Unauthorized.

After this first failure, the logout flow clears local storage and redirects the user, so the same symptom usually does not recur right away.

How To Reproduce

  1. Allow a previous login session token to expire.
  2. Open or refresh the root route, for example /
  3. Observe the network request to /api/v1/devices/stats.
  4. Confirm that the response is 401 Unauthorized during this initial load sequence.
Image

What Is Expected

When a previous session token has expired, the application should detect that state before making requests that require a valid login token.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingstability-testsBugs captured during stability testinguser-experienceImprovements focused on usability, workflows, accessibility, and the overall user experience.

Type

Projects

Status
In Progress
Status
Q3 2026

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions