fix(web,api): fix WebSocket authentication for chat real-time connection (#547)
Some checks failed
ci/woodpecker/push/web Pipeline failed
ci/woodpecker/push/api Pipeline was successful

Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #547.
This commit is contained in:
2026-02-27 11:30:44 +00:00
committed by jason.woltje
parent 6ac63fe755
commit c0e679ab7c
3 changed files with 68 additions and 3 deletions

View File

@@ -97,9 +97,12 @@ export function useWebSocket(
setConnectionError(null);
// Create socket connection
// withCredentials sends session cookies cross-origin so the gateway can
// authenticate via cookie when no explicit token is provided.
const newSocket = io(wsUrl, {
auth: { token },
query: { workspaceId },
withCredentials: true,
});
setSocket(newSocket);