Skip to content

fix/channel message auth token#259

Merged
xiami762 merged 2 commits into
devfrom
fix/channel-message-auth-token
May 12, 2026
Merged

fix/channel message auth token#259
xiami762 merged 2 commits into
devfrom
fix/channel-message-auth-token

Conversation

@duguwanglong
Copy link
Copy Markdown
Contributor

refactor(channel_message): reuse API_TOKEN_SECRET_ID and clarify fallback

  • Import API_TOKEN_SECRET_ID from flocks.server.auth instead of
    hardcoding "server_api_token" so the client and server-side auth
    middleware cannot drift out of sync and silently start failing 401.
  • Refine the comment on the 401 fallback: distinguish "client did not
    obtain a token" from "server has no token configured", and make it
    explicit that when we DID send a token but it was rejected we do not
    fall back, surfacing the server detail so misconfiguration is visible.

duguwanglong and others added 2 commits May 12, 2026 14:35
_http_session_send was posting to /api/channel/session-send without an
Authorization header, so the server-side auth middleware rejected it as a
non-browser request and returned HTTP 401.

Read the API token from the secret manager (server_api_token) and inject
it as Authorization: Bearer <token>. If no token is configured locally
and the server still returns 401, silently fall back to the in-process
delivery path so the tool keeps working in unauthenticated setups.

Co-authored-by: Cursor <cursoragent@cursor.com>
…back

- Import API_TOKEN_SECRET_ID from flocks.server.auth instead of
  hardcoding "server_api_token" so the client and server-side auth
  middleware cannot drift out of sync and silently start failing 401.
- Refine the comment on the 401 fallback: distinguish "client did not
  obtain a token" from "server has no token configured", and make it
  explicit that when we DID send a token but it was rejected we do not
  fall back, surfacing the server detail so misconfiguration is visible.

Co-authored-by: Cursor <cursoragent@cursor.com>
@duguwanglong duguwanglong requested a review from xiami762 May 12, 2026 06:37
@xiami762 xiami762 merged commit 31a54f4 into dev May 12, 2026
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.

2 participants