From d1932b33d08bf2b98ca002e44b8626f3af59efac Mon Sep 17 00:00:00 2001 From: Igor Somov Date: Mon, 2 Mar 2026 20:35:06 -0300 Subject: [PATCH 1/2] fix(pairing): support websocket auth token input --- README.md | 7 +-- docs/operations.md | 3 +- src/lib/components/ConnectionModal.svelte | 4 +- src/lib/components/PairingScreen.svelte | 16 ++++++- src/lib/components/PairingScreen.test.ts | 27 +++++++++++- src/lib/protocol/ws-url.test.ts | 42 ++++++++++++++++++ src/lib/protocol/ws-url.ts | 44 +++++++++++++++++++ .../session/connection-controller.svelte.ts | 10 +++-- 8 files changed, 141 insertions(+), 12 deletions(-) create mode 100644 src/lib/protocol/ws-url.test.ts create mode 100644 src/lib/protocol/ws-url.ts diff --git a/README.md b/README.md index e02e7eb..c6cb7ad 100644 --- a/README.md +++ b/README.md @@ -49,8 +49,9 @@ Open `http://localhost:5173`. ### 4) Pair with an agent 1. Enter the WebSocket endpoint (default: `ws://127.0.0.1:32123/ws`). -2. Enter a 6-digit pairing PIN. -3. After `pairing_result`, the UI switches to chat mode. +2. If your backend requires `web.accounts..auth_token` (common for non-loopback binds), set it in the optional `auth_token` field. +3. Enter a 6-digit pairing PIN. +4. After `pairing_result`, the UI switches to chat mode. ## Scripts @@ -101,7 +102,7 @@ Detailed docs: `localStorage` keys: -- `nullclaw_ui_auth_v1` - endpoint URL, `access_token`, `shared_key`, `expires_at`. +- `nullclaw_ui_auth_v1` - endpoint URL (may include `?token=` when used), `access_token`, `shared_key`, `expires_at`. - `nullclaw_ui_theme` - current theme. - `nullclaw_ui_effects` - visual effects toggle. diff --git a/docs/operations.md b/docs/operations.md index e9e9a77..47377fb 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -24,6 +24,7 @@ Implications: WebSocket endpoint is currently user-entered in `PairingScreen`. Default value: `ws://127.0.0.1:32123/ws`. +For deployments that enforce `web.accounts..auth_token`, users can provide the value via the optional `auth_token` field in the pairing form (it is appended as `?token=...` when opening the WebSocket). To change default endpoint, update initial `url` in `src/lib/components/PairingScreen.svelte`. @@ -31,7 +32,7 @@ To change default endpoint, update initial `url` in `src/lib/components/PairingS `nullclaw_ui_auth_v1` in local storage includes: -- endpoint URL +- endpoint URL (may include `token` query param when configured in UI) - `access_token` - `shared_key` (base64url) - `expires_at` diff --git a/src/lib/components/ConnectionModal.svelte b/src/lib/components/ConnectionModal.svelte index 858b9e6..9ee05ad 100644 --- a/src/lib/components/ConnectionModal.svelte +++ b/src/lib/components/ConnectionModal.svelte @@ -1,5 +1,6 @@