<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Authentication on FixClaw</title>
        <link>https://fixclaw.dev/tags/authentication/</link>
        <description>Recent content in Authentication on FixClaw</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en-us</language>
        <lastBuildDate>Mon, 01 Jan 0001 00:00:00 +0000</lastBuildDate><atom:link href="https://fixclaw.dev/tags/authentication/index.xml" rel="self" type="application/rss+xml" /><item>
            <title>Chrome Extension Relay Authentication Failing with 401 - Valid HMAC Token Rejected</title>
            <link>https://fixclaw.dev/troubleshooting/chrome-extension-relay-authentication-failing-with-401---valid-hmac-token-reject/</link>
            <pubDate>Tue, 10 Mar 2026 00:00:00 +0000</pubDate>
            <guid>https://fixclaw.dev/troubleshooting/chrome-extension-relay-authentication-failing-with-401---valid-hmac-token-reject/</guid>
            <description>&lt;h2 id=&#34;symptom&#34;&gt;Symptom&#xA;&lt;/h2&gt;&lt;p&gt;When attempting to connect the OpenClaw Chrome extension to the browser control server, authentication fails with &lt;strong&gt;401 Unauthorized&lt;/strong&gt; even when:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The gateway token is correctly configured&lt;/li&gt;&#xA;&lt;li&gt;The HMAC-SHA256 token is properly derived using the documented formula: &lt;code&gt;HMAC(gatewayToken, &amp;quot;openclaw-extension-relay-v1:{port}&amp;quot;)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;The correct port (18791 = Gateway + 2) is used&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The extension options page displays the error: &lt;strong&gt;&amp;ldquo;Gateway token rejected. Check token and save again.&amp;rdquo;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;diagnostic-evidence&#34;&gt;Diagnostic Evidence&#xA;&lt;/h3&gt;&lt;p&gt;Direct API calls with derived HMAC tokens also fail:&lt;/p&gt;&#xA;&lt;h1 id=&#34;hmac-derived-relay-token&#34;&gt;HMAC-derived relay token&#xA;&lt;/h1&gt;&lt;p&gt;curl -H &amp;ldquo;x-openclaw-relay-token: 31ef63af71285c00acf36a78a3a33619a34b947fa99c4d8b149f5566b22d219f&amp;rdquo; &lt;br&gt;&#xA;http://127.0.0.1:18791/json/version&lt;/p&gt;&#xA;&lt;h1 id=&#34;result-401-unauthorized&#34;&gt;Result: 401 Unauthorized&#xA;&lt;/h1&gt;&lt;p&gt;The browser control server is confirmed to be running:&#xA;Browser control listening on http://127.0.0.1:18791/ (auth=token)&lt;/p&gt;&#xA;&lt;h2 id=&#34;root-cause-analysis&#34;&gt;Root Cause Analysis&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-server-side-hmac-relay-authentication-not-implemented&#34;&gt;1. Server-Side HMAC Relay Authentication Not Implemented&#xA;&lt;/h3&gt;&lt;p&gt;The primary root cause appears to be that the &lt;strong&gt;browser control server does not implement HMAC relay token authentication&lt;/strong&gt;. The server is configured with &lt;code&gt;auth=token&lt;/code&gt; but only accepts the raw gateway Bearer token, not the HMAC-SHA256 derived relay tokens that the extension generates.&lt;/p&gt;&#xA;&lt;p&gt;The extension correctly derives the relay token using:&#xA;HMAC-SHA256(gatewayToken, &amp;ldquo;openclaw-extension-relay-v1:{port}&amp;rdquo;)&lt;/p&gt;&#xA;&lt;p&gt;However, the server&amp;rsquo;s authentication middleware only validates Bearer tokens directly, failing to:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Recognize the &lt;code&gt;x-openclaw-relay-token&lt;/code&gt; header format&lt;/li&gt;&#xA;&lt;li&gt;Validate HMAC-derived tokens against the gateway token&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;2-port-derivation-documentation-mismatch&#34;&gt;2. Port Derivation Documentation Mismatch&#xA;&lt;/h3&gt;&lt;p&gt;There is a discrepancy between documentation and implementation:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Documentation states&lt;/strong&gt;: Relay port = Gateway + 3 (e.g., 18789 + 3 = 18792)&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Actual behavior&lt;/strong&gt;: Server listens on Gateway + 2 (e.g., 18789 + 2 = 18791)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;While the actual port (18791) works for connection, this inconsistency may cause confusion during troubleshooting.&lt;/p&gt;&#xA;&lt;h3 id=&#34;3-dual-installation-conflict-contributing-factor&#34;&gt;3. Dual Installation Conflict (Contributing Factor)&#xA;&lt;/h3&gt;&lt;p&gt;The user performed a dual installation:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Installed via OpenClaw.app on February 9&lt;/li&gt;&#xA;&lt;li&gt;Added CLI setup on February 13&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;This creates two separate state directories:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;App state: &lt;code&gt;~/Library/Application Support/OpenClaw/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;CLI state: &lt;code&gt;~/.openclaw/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Configuration stored in one location may conflict with the other, though the immediate authentication failure occurs regardless of which state directory is active.&lt;/p&gt;&#xA;&lt;h2 id=&#34;solution&#34;&gt;Solution&#xA;&lt;/h2&gt;&lt;h3 id=&#34;immediate-workaround&#34;&gt;Immediate Workaround&#xA;&lt;/h3&gt;&lt;p&gt;&lt;strong&gt;Use the raw gateway Bearer token instead of HMAC-derived token:&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;For direct API calls:&#xA;curl -H &amp;ldquo;Authorization: Bearer fc001f30ef28a2a7e12f6f39e46ac4337cbfaff08c00585c&amp;rdquo; &lt;br&gt;&#xA;http://127.0.0.1:18791/json/version&lt;/p&gt;&#xA;&#xA;    &lt;blockquote&gt;&#xA;        &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: This workaround may not resolve extension connectivity since the extension code specifically uses HMAC-derived tokens.&lt;/p&gt;&#xA;&#xA;    &lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;verify-correct-port-configuration&#34;&gt;Verify Correct Port Configuration&#xA;&lt;/h3&gt;&lt;p&gt;The relay server listens on &lt;strong&gt;Gateway + 2&lt;/strong&gt;, not Gateway + 3:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;Gateway Port&lt;/th&gt;&#xA;          &lt;th&gt;Expected (Docs)&lt;/th&gt;&#xA;          &lt;th&gt;Actual (Server)&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;18789&lt;/td&gt;&#xA;          &lt;td&gt;18792&lt;/td&gt;&#xA;          &lt;td&gt;18791&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Confirm your extension options use port &lt;strong&gt;18791&lt;/strong&gt; (Gateway + 2).&lt;/p&gt;&#xA;&lt;h3 id=&#34;check-server-logs-for-authentication-attempts&#34;&gt;Check Server Logs for Authentication Attempts&#xA;&lt;/h3&gt;&lt;p&gt;openclaw logs &amp;ndash;level debug | grep -i &amp;ldquo;auth|relay|401|token&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;Look for entries indicating whether the server received the &lt;code&gt;x-openclaw-relay-token&lt;/code&gt; header and why it was rejected.&lt;/p&gt;&#xA;&lt;h3 id=&#34;verify-configuration-file-location&#34;&gt;Verify Configuration File Location&#xA;&lt;/h3&gt;&lt;p&gt;Ensure you are editing the correct configuration file:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;For CLI installation:&lt;/strong&gt;&#xA;cat ~/.openclaw/openclaw.json&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;For App installation:&lt;/strong&gt;&#xA;cat ~/Library/Application\ Support/OpenClaw/openclaw.json&lt;/p&gt;&#xA;&lt;h2 id=&#34;prevention&#34;&gt;Prevention&#xA;&lt;/h2&gt;&lt;h3 id=&#34;1-use-single-installation-method&#34;&gt;1. Use Single Installation Method&#xA;&lt;/h3&gt;&lt;p&gt;Avoid using both OpenClaw.app and CLI on the same system. Choose one installation method:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;For GUI-focused usage&lt;/strong&gt;: Use OpenClaw.app only&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;For CLI/developer usage&lt;/strong&gt;: Use CLI installation only (&lt;code&gt;npm install -g openclaw&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;2-document-your-installation-method&#34;&gt;2. Document Your Installation Method&#xA;&lt;/h3&gt;&lt;p&gt;After installation, note which method was used and the associated configuration path:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;CLI: &lt;code&gt;~/.openclaw/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;App: &lt;code&gt;~/Library/Application Support/OpenClaw/&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;3-verify-extension-relay-port&#34;&gt;3. Verify Extension Relay Port&#xA;&lt;/h3&gt;&lt;p&gt;Before configuring the extension, verify the actual relay port by checking the server startup logs:&lt;/p&gt;&#xA;&lt;p&gt;openclaw browser start&lt;/p&gt;&#xA;&lt;h1 id=&#34;look-for-browser-control-listening-on-http127001xxxxx&#34;&gt;Look for: Browser control listening on http://127.0.0.1:XXXXX/&#xA;&lt;/h1&gt;&lt;h3 id=&#34;4-validate-gateway-token-format&#34;&gt;4. Validate Gateway Token Format&#xA;&lt;/h3&gt;&lt;p&gt;Ensure the gateway token:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Is 40+ characters (hex-encoded)&lt;/li&gt;&#xA;&lt;li&gt;Does not contain typos&lt;/li&gt;&#xA;&lt;li&gt;Matches exactly between config file and extension options&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;additional-information&#34;&gt;Additional Information&#xA;&lt;/h2&gt;&lt;h3 id=&#34;hmac-token-derivation-reference&#34;&gt;HMAC Token Derivation Reference&#xA;&lt;/h3&gt;&lt;p&gt;The Chrome extension derives relay tokens using this formula:&lt;/p&gt;&#xA;&lt;p&gt;const relayToken = HMAC-SHA256(&#xA;gatewayToken,&#xA;&lt;code&gt;openclaw-extension-relay-v1:${port}&lt;/code&gt;&#xA;);&lt;/p&gt;&#xA;&lt;p&gt;Where:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;gatewayToken&lt;/code&gt; = The token from &lt;code&gt;openclaw.json&lt;/code&gt; gateway config&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;port&lt;/code&gt; = Browser control server port (18791)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;expected-server-behavior&#34;&gt;Expected Server Behavior&#xA;&lt;/h3&gt;&lt;p&gt;The browser control server should:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Accept &lt;code&gt;Authorization: Bearer {gatewayToken}&lt;/code&gt; header (direct API access)&lt;/li&gt;&#xA;&lt;li&gt;Accept &lt;code&gt;x-openclaw-relay-token: {hmacDerivedToken}&lt;/code&gt; header (extension relay)&lt;/li&gt;&#xA;&lt;li&gt;Validate HMAC tokens by deriving them server-side and comparing&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;environment-details&#34;&gt;Environment Details&#xA;&lt;/h3&gt;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;Component&lt;/th&gt;&#xA;          &lt;th&gt;Version/Value&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;OpenClaw&lt;/td&gt;&#xA;          &lt;td&gt;2026.3.1 (2a8ac97)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Node.js&lt;/td&gt;&#xA;          &lt;td&gt;v22.22.0&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;OS&lt;/td&gt;&#xA;          &lt;td&gt;macOS (Darwin 25.3.0 arm64)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Gateway Port&lt;/td&gt;&#xA;          &lt;td&gt;18789&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Relay Port&lt;/td&gt;&#xA;          &lt;td&gt;18791 (Gateway + 2)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;sources&#34;&gt;Sources&#xA;&lt;/h2&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/openclaw/openclaw/issues/32449&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitHub Issue #32449&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description>
        </item></channel>
</rss>
