Skip to content

Bug Report: Invalid Authentication Token Errors After Logout #2868

@Sanady

Description

@Sanady

Describe the bug
When logging out from a Chainlit application, the UI repeatedly displays errors stating "Invalid authentication token". In the browser’s DevTools console, these appear as recurring 401 Unauthorized network errors.
The logout itself is successful — the user session ends correctly — but the application continues trying to call authenticated endpoints every ~15 seconds, causing a flood of errors.

To Reproduce
Steps to reproduce the behavior:

  1. Open the Chainlit application.
  2. Log in with a valid user.
  3. Click Logout.
  4. Observe UI error toasts stating "Invalid authentication token".
  5. Open DevTools → Network tab → see recurring 401 Unauthorized requests continuing even after logout.

Expected behavior
After logging out:
The UI should stop making authenticated API calls.
No error toasts or console errors should appear.
Any background polling, websocket, or refresh loops should be terminated on logout.

Screenshots
imgur screenshots

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Microsoft Edge
  • Version: 146.0.3856.84 (Official build) (64‑bit)
  • Device: Notebook

Additional context
The issue occurs consistently.
Requests continue to fire approximately every ~15 seconds in debug mode, suggesting that a background polling loop or web-socket reconnect attempts are not being cleaned up upon logout.
The logout endpoint works correctly — the user session ends — but the UI continues behaving as if still logged in and attempting protected API calls with an expired/invalid token.

Metadata

Metadata

Assignees

No one assigned

    Labels

    authPertaining to authentication.bugSomething isn't workingfrontendPertains to the frontend.needs-triage

    Type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions