Spaces:
Paused
Paused
fix(terminal): inject GATEWAY_TOKEN into JupyterLab proxy to skip double login prompt
Browse fileshealth-server.js reads JUPYTER_TOKEN at process start, but start_jupyter()
only exports it later — so the env var is empty and no auth header is
injected, causing JupyterLab to show its own login screen after the user
already authenticated with GATEWAY_TOKEN.
Fix: fall back to API_SERVER_KEY (== GATEWAY_TOKEN), which is exactly what
JupyterLab was started with. User authenticates once; no second prompt.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
949 unmodified lines950951952953954955956949 unmodified lines}// Inject the Jupyter token so JupyterLab skips its own login screen.// User already authenticated via GATEWAY_TOKEN — no second prompt needed.const jToken = process.env.JUPYTER_TOKEN || "";const overrides = jToken ? { authorization: `token ${jToken}` } : {};proxyRequest(req, res, JUPYTER_PORT, (p) => p, overrides);});949 unmodified lines950951952953954955956957958959960949 unmodified lines}// Inject the Jupyter token so JupyterLab skips its own login screen.// User already authenticated via GATEWAY_TOKEN — no second prompt needed.// JUPYTER_TOKEN env may be empty in this process (health-server starts before// start_jupyter() exports it), so fall back to API_SERVER_KEY (== GATEWAY_TOKEN),// which is what JupyterLab was actually started with.const rawJToken = (process.env.JUPYTER_TOKEN || "").trim();const jToken = rawJToken || API_SERVER_KEY;const overrides = jToken ? { authorization: `token ${jToken}` } : {};proxyRequest(req, res, JUPYTER_PORT, (p) => p, overrides);});
health-server.js+5-1