Skip to content

How to use openclaw gateway token? #16

Closed

Description

@mateu

Question

How to configure the code-editor to use an openclaw gateway token?

Context

I have the OpenKnots code-editor up and running on a macos client. I'd like to connect it to my openclaw gateway on another (linux) computer on my LAN. I have an ssh tunnel setup and ready to go so I think I should be able use to ws://localhost:18789 but I need a gateway auth token configured which I don't know how to do? I have a token all ready. I'm just looking to make the code-editor aware of the gateway auth token and use it to establish a connection.

Activity

  1. mateu commented on Mar 10, 2026

    @mateu
    ContributorAuthor

    I'm willing to work on a patch if it's a feature that's not currently available and there's interest to have it.

  2. BunsDev commented on Mar 12, 2026

    @BunsDev
    Member

    Hey @mateu — great question, and thanks for jumping in with the fix!

    Your PR #17 has been merged 🎉 — the code-editor now supports gateway token auth out of the box.

    How it works now

    Option A: Config file (recommended)

    In ~/.openclaw/openclaw.json, nest your token under the gateway auth block:

    {
      "gateway": {
        "port": 18789,
        "auth": {
          "mode": "token",
          "token": "your-gateway-token-here"
        }
      }
    }

    The desktop app reads this on launch and connects automatically.

    Option B: Environment variable

    Set OPENCLAW_GATEWAY_TOKEN in your shell before launching:

    export OPENCLAW_GATEWAY_TOKEN="your-gateway-token-here"

    This is used as a fallback if the config file doesn't have a token.

    Option C: Manual connect via the UI

    Enter ws://localhost:18789 as the gateway URL and your token as the credential in the connection dialog.


    With your SSH tunnel pointing localhost:18789 → your Linux gateway, any of these should get you connected. The client now sends the credential as both auth.password and auth.token so it works regardless of which auth mode your gateway is configured with.

    A small follow-up rename landed in #18 (cosmetic only — password → credential in the config struct for clarity).

    Closing this since #17 addresses the original question — feel free to reopen if you hit any issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions