Skip to content

fix: Always scrape dashboard session token from HTML - #404

Closed
Joselma-Jemk wants to merge 1 commit into
outsourc-e:mainfrom
Joselma-Jemk:fix/dashboard-session-token
Closed

fix: Always scrape dashboard session token from HTML#404
Joselma-Jemk wants to merge 1 commit into
outsourc-e:mainfrom
Joselma-Jemk:fix/dashboard-session-token

Conversation

@Joselma-Jemk

Copy link
Copy Markdown

Summary

  • Fix 401 Unauthorized errors when workspace calls dashboard API
  • Hermes Agent dashboard uses ephemeral session tokens injected via window.__HERMES_SESSION_TOKEN__ (changes on restart)
  • Removed bearer token preference logic - always scrape token from HTML

Root Cause

The regex window\.__(?:CLAUDE|HERMES)_SESSION_TOKEN__ was incorrect - it matched only ONE underscore between HERMES and SESSION, but actual HTML has __HERMES_SESSION_TOKEN__ (double underscores on both sides).

Fixed regex: /window\._+(?:CLAUDE|HERMES)_+SESSION_TOKEN__+\s*=\s*["']([^"']+)["']/

Changes

  • src/server/gateway-capabilities.ts:
    • Fixed DASHBOARD_TOKEN_REGEX to match double underscores
    • Removed DASHBOARD_BEARER_TOKEN preference - always scrape HTML
    • Updated docstring to explain ephemeral session token behavior

The Hermes Agent dashboard uses an ephemeral session token injected
via window.__HERMES_SESSION_TOKEN__ (changes on restart). The previous
regex was incorrect - it matched only one underscore between HERMES
and SESSION, but actual HTML has __HERMES_SESSION_TOKEN__.

Fixed regex to match double underscores and always scrape token
from HTML root page instead of using bearer token fallback.

Fixes 401 Unauthorized errors when workspace calls dashboard API.
@outsourc-e

Copy link
Copy Markdown
Owner

Closing as superseded by #432. The validated fix was folded into the consolidated batch branch fix/issue-sweep-batch-20260514 for one review/merge path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants