From fb53af642dd8fc2d103b9dad533e94dc3317596f Mon Sep 17 00:00:00 2001 From: operator Date: Sun, 19 Apr 2026 05:44:11 +0000 Subject: [PATCH] fix: pass gateway token via URL query parameter Gateway may validate auth during HTTP upgrade before WebSocket messages can be sent. Co-Authored-By: Claude Opus 4.6 (1M context) --- plugin/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/index.ts b/plugin/index.ts index 68aa32a..2a66a23 100644 --- a/plugin/index.ts +++ b/plugin/index.ts @@ -212,7 +212,9 @@ export default { reject(new Error('Gateway connection timeout')); }, 15000); - const client = new (globalThis as any).WebSocket(gatewayUrl); + // Pass token via Authorization header in the upgrade request + const wsUrl = gwToken ? `${gatewayUrl}?token=${encodeURIComponent(gwToken)}` : gatewayUrl; + const client = new (globalThis as any).WebSocket(wsUrl); client.onerror = (err: any) => { clearTimeout(timeout);