From 4db167b04510a987490e2c27b27eafeb234faaec Mon Sep 17 00:00:00 2001 From: amitbardos Date: Sun, 4 Oct 2026 17:18:59 +0300 Subject: [PATCH] fix(white-label-minimal): send the workspace key as a Bearer token when opening a socket session POST /api/service/socket-sessions reads the key with extract_bearer_token, so the bare key got 401, which the example reported as a missing apps:watch scope and paused live updates. Co-Authored-By: Claude Opus 5.5 --- examples/white-label-minimal/lib/base44/socket-session.ts | 2 +- examples/white-label-minimal/tests/server.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/white-label-minimal/lib/base44/socket-session.ts b/examples/white-label-minimal/lib/base44/socket-session.ts index 6845efe..3be572f 100644 --- a/examples/white-label-minimal/lib/base44/socket-session.ts +++ b/examples/white-label-minimal/lib/base44/socket-session.ts @@ -8,7 +8,7 @@ export async function openSocketSession(appId: string) { const { host } = getBase44Config(); const response = await fetch(`${host}/api/service/socket-sessions`, { method: "POST", - headers: { Authorization: process.env.BASE44_SVC_KEY ?? "", "Content-Type": "application/json" }, + headers: { Authorization: `Bearer ${process.env.BASE44_SVC_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ app_ids: [appId] }), cache: "no-store", }); diff --git a/examples/white-label-minimal/tests/server.test.ts b/examples/white-label-minimal/tests/server.test.ts index f9516fc..5458f9f 100644 --- a/examples/white-label-minimal/tests/server.test.ts +++ b/examples/white-label-minimal/tests/server.test.ts @@ -199,7 +199,7 @@ test('the live-updates session opens with the workspace key only after sign-in a assert.equal(response.status, 200); assert.deepEqual(await response.json(), { serverUrl: 'https://platform.example', sessionToken: 'wlst_canary' }); assert.equal(calls[0].url, 'https://platform.example/api/service/socket-sessions'); - assert.equal(new Headers(calls[0].init!.headers).get('authorization'), 'b44k_workspace'); + assert.equal(new Headers(calls[0].init!.headers).get('authorization'), 'Bearer b44k_workspace'); assert.deepEqual(JSON.parse(String(calls[0].init!.body)), { app_ids: ['app_1'] }); assert.equal((await request({ action: 'openBuilderSession', appId: 'other_app' })).status, 404); signedIn = false;