Desktop (macOS) reports Claude "Not authenticated" when auth comes from CLAUDE_CODE_OAUTH_TOKEN in the shell profile#22816

openedOct 21, 2026byPPit-CL

What happened

The Claude provider card on the macOS desktop app's local environment shows "Not authenticated · Claude Code is not authenticated. Run claude auth login and try again." Claude itself is authenticated and works fine: claude auth status in a terminal reports loggedIn: true. The message appears every time, not intermittently.

Diagnosis

The user authenticates Claude Code with a long-lived token exported from the shell profile (export CLAUDE_CODE_OAUTH_TOKEN=... in ~/.zshrc, created with claude setup-token). They do not keep a keychain OAuth login. In a terminal, claude auth status reports "authMethod": "oauth_token".

The desktop app is launched from the Dock and inherits launchd's environment, which does not include that variable. DesktopShellEnvironment hydrates only a fixed allowlist of names from the login shell (apps/desktop/src/shell/DesktopShellEnvironment.ts:76-99: PATH, locale, SSH_AUTH_SOCK, XDG_*, cert vars, and so on). CLAUDE_CODE_OAUTH_TOKEN (and ANTHROPIC_API_KEY) are not on that list, so the local backend spawns claude without any credential.

The capabilities probe then gets tokenSource: "none" with no email or subscription, and claudeAuthStatus() returns unauthenticated (apps/server/src/provider/ClaudeProvider.ts:176-190, message at :647).

Checked on the machine: the running desktop app process has no CLAUDE_CODE_OAUTH_TOKEN in its environment, and launchctl getenv CLAUDE_CODE_OAUTH_TOKEN is empty.

The status is technically correct for the backend's environment, but it is confusing. The user is logged in from every terminal, and the suggested remedy (claude auth login) is not what they use. Two possible improvements:

  • Hydrate Claude auth env vars (CLAUDE_CODE_OAUTH_TOKEN, and possibly ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN) from the login shell, the same way PATH is hydrated.
  • Or, when the probe reports tokenSource: "none" and the login shell defines one of those vars, say so ("found CLAUDE_CODE_OAUTH_TOKEN in your shell, but the desktop app does not inherit it") instead of suggesting claude auth login.

main has no change to DesktopShellEnvironment.ts that adds these names (latest commits checked on 2026-10-21).

Steps to reproduce

  1. On macOS, make sure there is no valid Claude keychain login, and authenticate with claude setup-token.
  2. Add export CLAUDE_CODE_OAUTH_TOKEN=<token> to ~/.zshrc only. In a new terminal, claude auth status shows loggedIn: true, authMethod: oauth_token.
  3. Launch T3 Code desktop from the Dock/Finder.
  4. Settings → Providers → Claude (local environment) shows "Not authenticated".

Version

T3 Code desktop (Beta) 0.1.1

Environment

macOS 26.7.1 (arm64), claude 2.1.306. Threads run against a remote t3 serve 0.1.1 on Linux, where Claude reports authenticated.

Evidence

shell
1# local desktop backend provider cache (~/.t3/caches/claudeAgent.json)
2status = error
3auth.status = unauthenticated
4message = Claude Code is not authenticated. Run `claude auth login` and try again.
5checkedAt = 2026-10-21T10:40:21.515Z
6
7# same CLI, from an interactive terminal
8$ claude auth status
9{ "loggedIn": true, "authMethod": "oauth_token", "apiProvider": "firstParty", ... }
10
11# desktop app process environment
12CLAUDE_CODE_OAUTH_TOKEN present: no
13launchctl getenv CLAUDE_CODE_OAUTH_TOKEN: (empty)

#2653 (Max OAuth "could not verify authentication status", closed: a different probe-parsing bug). #17936 (SSH-launched server on macOS can't read the login keychain: a different credential path). #14186 is the inverse case (false "authenticated"). None covers env-var tokens not reaching the desktop backend.

Fix applied or workaround

Disabled the Claude provider in the Mac's local environment; Claude is used only through the remote server. Alternative: launchctl setenv CLAUDE_CODE_OAUTH_TOKEN ... before launching the app (does not persist across reboots).

Filed by

Claude Code (claude-opus-5-5) via t3 triage

Confirmed on main with a real Bash login profile and the desktop environment service: PATH is imported, but CLAUDE_CODE_OAUTH_TOKEN is dropped. #23240 captures the token and preserves any inherited value. Focused tests: 14 passed. Before/after runtime evidence.

Verified on Linux using isolated source at 8acbefefc5 and the fixed source. Native macOS Dock/zsh and provider-card authentication remain unverified here.

Synced from GitHub

Same here, connecting T3 0.1.3 to a remote macmini 27.2 over ssh:

"displayName": "Claude", "showInteractionModeToggle": true, "reportsContextWindow": true, "enabled": true, "installed": true, "version": "2.1.319", "status": "error", "auth": { "status": "unauthenticated" },

Edit:

It all boils down to a remote session through SSH requiring some help to access the keychain. If claudecode cannot access the keychain, it stores credential in an env file (a bit exposed) so a relogin can fix this. If the user wants to use the remote keychain, the pair option in t3code can do it, or the following can be done to the remote machine:

add to ~/.zshrc

if [ -n "$SSH_CONNECTION" ]; then security unlock-keychain ~/Library/Keychains/login.keychain-db 2>/dev/null || true fi