[PR #400] [MERGED] Add query-token fallback for agent huddle SSE authentication #703

Closed
opened 2026-03-13 21:04:48 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AJaySi/ALwrity/pull/400
Author: @AJaySi
Created: 3/9/2026
Status: Merged
Merged: 3/9/2026
Merged by: @AJaySi

Base: mainHead: codex/fix-authentication-error-for-token-verification


📝 Commits (1)

  • c3bd04e Fix huddle SSE auth fallback with query token support

📊 Changes

2 files changed (+7 additions, -3 deletions)

View changed files

📝 backend/api/agents_api.py (+2 -2)
📝 frontend/src/hooks/useAgentHuddleFeed.ts (+5 -1)

📄 Description

Motivation

  • The SSE endpoint GET /api/agents/huddle/stream was failing with token verification errors when Authorization headers were dropped or not forwarded (e.g., by some proxies or browser edge cases).
  • Add a secure fallback so streaming clients can still authenticate using a query token while preserving header-based auth as the primary mechanism.

Description

  • Use get_current_user_with_query_token for the /api/agents/huddle/stream endpoint in backend/api/agents_api.py to accept a token from either the header or the query string.
  • Update frontend/src/hooks/useAgentHuddleFeed.ts to append the auth token as a token query parameter to the SSE URL while still sending the Authorization: Bearer ... header.
  • Preserve existing authentication behavior for other endpoints and continue to prefer header-based auth when available.

Testing

  • Ran python -m compileall backend/api/agents_api.py backend/middleware/auth_middleware.py which completed successfully.
  • Attempted npm --prefix frontend run build but the build failed in this environment because react-scripts is not installed, so frontend build validation could not be completed.

Codex Task


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AJaySi/ALwrity/pull/400 **Author:** [@AJaySi](https://github.com/AJaySi) **Created:** 3/9/2026 **Status:** ✅ Merged **Merged:** 3/9/2026 **Merged by:** [@AJaySi](https://github.com/AJaySi) **Base:** `main` ← **Head:** `codex/fix-authentication-error-for-token-verification` --- ### 📝 Commits (1) - [`c3bd04e`](https://github.com/AJaySi/ALwrity/commit/c3bd04e25995beba9ca62b4e2ea098bdcd48cdb2) Fix huddle SSE auth fallback with query token support ### 📊 Changes **2 files changed** (+7 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `backend/api/agents_api.py` (+2 -2) 📝 `frontend/src/hooks/useAgentHuddleFeed.ts` (+5 -1) </details> ### 📄 Description ### Motivation - The SSE endpoint `GET /api/agents/huddle/stream` was failing with token verification errors when Authorization headers were dropped or not forwarded (e.g., by some proxies or browser edge cases). - Add a secure fallback so streaming clients can still authenticate using a query `token` while preserving header-based auth as the primary mechanism. ### Description - Use `get_current_user_with_query_token` for the `/api/agents/huddle/stream` endpoint in `backend/api/agents_api.py` to accept a token from either the header or the query string. - Update `frontend/src/hooks/useAgentHuddleFeed.ts` to append the auth token as a `token` query parameter to the SSE URL while still sending the `Authorization: Bearer ...` header. - Preserve existing authentication behavior for other endpoints and continue to prefer header-based auth when available. ### Testing - Ran `python -m compileall backend/api/agents_api.py backend/middleware/auth_middleware.py` which completed successfully. - Attempted `npm --prefix frontend run build` but the build failed in this environment because `react-scripts` is not installed, so frontend build validation could not be completed. ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_69abc35c0d208328a4c1a901e91acce6) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-13 21:04:48 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ALwrity#703
No description provided.