You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
macOS: Session Usage shows 'no credentials' when OAuth token is in credentials file instead of keychain #236
On macOS, the Session Usage widget displays "no credentials" even though a valid OAuth token exists in ~/.claude/.credentials.json.
Root Cause
In usage-fetch.ts, getUsageToken() has a platform-specific branch for macOS that only checks the keychain:
if(isMac){constresult=execSync('security find-generic-password -s "Claude Code-credentials" -w 2>/dev/null',{encoding: 'utf8',stdio: ['pipe','pipe','pipe']}).trim();consttoken=parseUsageAccessToken(result);// ...returntoken;// returns null — never falls back to credentials file}
This fails for two reasons:
GUID suffix mismatch — Claude Code stores the keychain entry under a name like "Claude Code-credentials-6248605b" (with a per-installation GUID suffix), but ccstatusline looks for the exact name "Claude Code-credentials" without the suffix.
No file fallback — Even when the keychain entry exists (with the suffixed name), the password data may not be readable from a non-interactive shell context. The non-macOS code path reads from ~/.claude/.credentials.json, but on macOS this fallback is never reached.
Steps to Reproduce
Install ccstatusline on macOS
Be logged into Claude Code via OAuth (valid token in ~/.claude/.credentials.json)
Add the Session Usage widget
Observe it shows "no credentials"
Verification
# Keychain entry exists but with a GUID suffix:
security dump-keychain | grep "Claude Code-credentials"# Output: "Claude Code-credentials-6248605b"# The credentials file has a valid token:
python3 -c "import json; d=json.load(open('$HOME/.claude/.credentials.json')); print('has token:', bool(d.get('claudeAiOauth',{}).get('accessToken')))"# Output: has token: True
Suggested Fix
On macOS, fall back to reading ~/.claude/.credentials.json when the keychain lookup fails:
if(isMac){// Try keychain first (with prefix matching for GUID-suffixed entries)// ...existing keychain logic...// Fall back to credentials file (same as non-macOS path)if(!token){constcredFile=path.join(getClaudeConfigDir(),'.credentials.json');token=parseUsageAccessToken(fs.readFileSync(credFile,'utf8'));}}
I saw this issue open and then close quickly. Is this still an issue? I've not seen a suffix on the keychain entry on macOS, nor have I seen Claude on macOS store credentials outside the keychain.
Confirmed workaround: copying the credentials from ~/.claude/.credentials.json into the keychain under the exact service name "Claude Code-credentials" fixes the widget.
This creates the keychain entry that getUsageToken() expects. Session Usage widget starts working immediately after.
The underlying issue remains though — on macOS, Claude Code v2.1.76 stores the OAuth token in ~/.claude/.credentials.json and creates a keychain entry under "Claude Code-credentials-6248605b" (with a GUID suffix), but ccstatusline only checks for the exact name "Claude Code-credentials" and never falls back to the credentials file.
I improved the lookup to first try an exact match of Claude Code-credentials, then fallback to any item starting with Claude Code-credentials (and if there are multiple it'll pick the most recently modified one), and failing that, it'll pull it from the credentials.json. This will go out when the next release is published.
Activity
sirmalloc commentedon Mar 15, 2026
I saw this issue open and then close quickly. Is this still an issue? I've not seen a suffix on the keychain entry on macOS, nor have I seen Claude on macOS store credentials outside the keychain.
bdbb commentedon Mar 15, 2026
Yes, still an issue! Sorry about the close/reopen, that was accidental.
Here's what I'm seeing on macOS (Claude Code v2.1.76):
Keychain entry has a GUID suffix:
There is no entry for the exact name
"Claude Code-credentials"(without suffix).Credentials file exists and has a valid token:
Keychain entry exists but
-wreturns empty:So the problem is two things:
-6248605b) thatgetUsageToken()doesn't account for-wreturns nothing, and there's no fallback to~/.claude/.credentials.jsonon macOSThe non-macOS code path already reads from the credentials file. Adding a fallback on macOS would fix it.
bdbb commentedon Mar 15, 2026
Confirmed workaround: copying the credentials from
~/.claude/.credentials.jsoninto the keychain under the exact service name"Claude Code-credentials"fixes the widget.This creates the keychain entry that
getUsageToken()expects. Session Usage widget starts working immediately after.The underlying issue remains though — on macOS, Claude Code v2.1.76 stores the OAuth token in
~/.claude/.credentials.jsonand creates a keychain entry under"Claude Code-credentials-6248605b"(with a GUID suffix), but ccstatusline only checks for the exact name"Claude Code-credentials"and never falls back to the credentials file.sirmalloc commentedon Mar 15, 2026
I improved the lookup to first try an exact match of
Claude Code-credentials, then fallback to any item starting withClaude Code-credentials(and if there are multiple it'll pick the most recently modified one), and failing that, it'll pull it from thecredentials.json. This will go out when the next release is published.Fix macOS usage token keychain fallback
bdbb commentedon Mar 15, 2026
Amazing, thank you so much for your time!
Fix macOS usage token keychain fallback
Fix macOS usage token keychain fallback