openclaw - 💡(How to fix) Fix [Bug/UX] Control UI loses gateway token after container rebuild [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#43706Fetched 2026-04-08 00:16:57
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
subscribed ×1unsubscribed ×1

Error Message

  1. Result: gateway token mismatch error

Root Cause

Token stored in session/memory only, invalidated on WebSocket disconnect. Not persisted to local storage or keychain.

RAW_BUFFERClick to expand / collapse

[Bug/UX] Control UI loses gateway token after container rebuild, causing persistent token mismatch errors

After every container rebuild (upgrade, restart), the Control UI desktop app loses connection and displays: unauthorized: gateway token mismatch

The user must manually re-enter the gateway token each time, even when the token value in .env has NOT changed.

Steps to Reproduce

  1. Install OpenClaw and configure gateway token in .env
  2. Open Control UI desktop app and enter token
  3. Run docker compose pull && docker compose up -d to upgrade
  4. Re-open Control UI
  5. Result: gateway token mismatch error

Expected Behavior

Control UI should reconnect automatically without re-entering token if .env token is unchanged.

Root Cause

Token stored in session/memory only, invalidated on WebSocket disconnect. Not persisted to local storage or keychain.

Suggested Fix

  • Option A (Preferred): Persist gateway token in desktop app's local storage or OS keychain
  • Option B: Add Remember token checkbox
  • Option C: Auto-reconnect with cached token on WebSocket disconnect

Environment

  • OpenClaw version: v2026.3.8
  • OS: macOS Sequoia (desktop) + Ubuntu 22.04 (server)
  • Deployment: Docker Compose on Alibaba Cloud ECS
  • Control UI: Desktop app (Electron wrapper)
  • SSH tunnel: Local port 18789/18790

Impact

Every upgrade requires manual token re-entry, creating friction for 24/7 AI assistant deployments.

extent analysis

Fix Plan

To address the issue, we will implement Option A: Persist gateway token in desktop app's local storage. This involves modifying the Control UI desktop app to store the gateway token securely.

Steps:

  1. Choose a storage method: Use a secure storage solution like electron-store or the OS keychain.
  2. Install dependencies: Run npm install electron-store or yarn add electron-store.
  3. Modify token storage:
const { app, BrowserWindow } = require('electron');
const Store = require('electron-store');

const store = new Store();

// Set token in storage
function setToken(token) {
  store.set('gatewayToken', token);
}

// Get token from storage
function getToken() {
  return store.get('gatewayToken');
}
  1. Update token handling:
// When the user enters the token, store it securely
document.getElementById('token-input').addEventListener('input', (e) => {
  const token = e.target.value;
  setToken(token);
});

// When reconnecting, use the stored token if available
function reconnect() {
  const storedToken = getToken();
  if (storedToken) {
    // Use the stored token to reconnect
    connectToGateway(storedToken);
  } else {
    // Prompt the user to enter the token
    promptForToken();
  }
}
  1. Implement secure storage: Use the OS keychain or a secure storage solution to store the token.

Verification

To verify the fix, follow these steps:

  • Run the modified Control UI desktop app.
  • Enter the gateway token and verify it is stored securely.
  • Restart the container and reopen the Control UI.
  • Verify the app reconnects automatically using the stored token.

Extra Tips

  • Ensure the storage solution is secure and follows best practices for storing sensitive data.
  • Consider implementing additional security measures, such as token encryption or secure token exchange protocols.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING