From fff46cd462816b794bf2b0131ddbe564ebc04729 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Mon, 25 May 2026 14:08:21 +0000 Subject: [PATCH] Studio: read auth bearer from the correct localStorage key (unsloth_auth_token) --- .../src/components/assistant-ui/html-svg-renderer.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/studio/frontend/src/components/assistant-ui/html-svg-renderer.tsx b/studio/frontend/src/components/assistant-ui/html-svg-renderer.tsx index 07b05c4136..2ec7177735 100644 --- a/studio/frontend/src/components/assistant-ui/html-svg-renderer.tsx +++ b/studio/frontend/src/components/assistant-ui/html-svg-renderer.tsx @@ -295,15 +295,12 @@ function buildHtmlSrcDoc(source: string): string { // via POST; the returned random-token URL becomes the iframe ``src``. const HTML_PREVIEW_API = "/api/preview/html"; +// Read the bearer the same way the rest of the app does. Pulled lazily to +// avoid any import cycle while keeping the auth-key contract in one place. function getStoredAccessToken(): string | null { - // Mirrors the bearer storage used by features/auth/. We avoid the import - // cycle by reading sessionStorage / localStorage directly. if (typeof window === "undefined") return null; try { - return ( - window.sessionStorage.getItem("unsloth.access_token") ?? - window.localStorage.getItem("unsloth.access_token") - ); + return window.localStorage.getItem("unsloth_auth_token"); } catch { return null; }