Skip to content

fix: add credentials file fallback for macOS when Keychain entry is missing#13

Closed
rbarcante wants to merge 1 commit into
tylergraydev:mainfrom
rbarcante:fix/macos-credentials-file-fallback
Closed

fix: add credentials file fallback for macOS when Keychain entry is missing#13
rbarcante wants to merge 1 commit into
tylergraydev:mainfrom
rbarcante:fix/macos-credentials-file-fallback

Conversation

@rbarcante

@rbarcante rbarcante commented Feb 9, 2026

Copy link
Copy Markdown

Summary

  • Adds file-based credential fallback for macOS (~/.claude/.credentials.json, etc.), matching existing Linux/Windows behavior
  • Adds support for multiple Keychain service names ("Claude Code" and "Claude Code-credentials")
  • Adds JSON parsing for Keychain values (credentials may be stored as a JSON object, not just a raw token)

Closes #12

Problem

On macOS, when the Keychain entry doesn't exist (e.g., after re-authenticating via /login in a tmux/byobu session where credentials get written to ~/.claude/.credentials.json instead of the Keychain), getOAuthTokenMacOS() returns null without trying file-based fallbacks. This causes usage segments to display --.

Test plan

  • All 164 existing tests pass
  • Verify on macOS without Keychain entry but with ~/.claude/.credentials.json → usage data displays correctly
  • Verify on macOS with Keychain entry → still works as before (no regression)

…issing

On macOS, when the Keychain entry for Claude Code doesn't exist (e.g.,
after re-authenticating in a tmux/byobu session), the token retrieval
fails silently and usage data shows as "--".

This adds:
- File-based fallback to ~/.claude/.credentials.json (and other paths),
  matching the existing behavior on Linux and Windows
- Support for multiple Keychain service names ("Claude Code" and
  "Claude Code-credentials") since different versions may use different names
- JSON parsing for Keychain values, since credentials may be stored as
  a JSON object rather than a raw token string

Closes tylergraydev#12
@rbarcante
rbarcante force-pushed the fix/macos-credentials-file-fallback branch from 251865b to 8696824 Compare February 9, 2026 13:06
@tylergraydev

Copy link
Copy Markdown
Owner

Closing — this was resolved by #15 (merged as df857d1), which implemented the same credential file fallback for macOS.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS: No fallback to ~/.claude/.credentials.json when Keychain entry is missing

2 participants