feat(oauth_claude): add macOS Keychain support for credential storage#38
Merged
CaddyGlow merged 5 commits intoCaddyGlow:mainfrom Feb 4, 2026
Merged
Conversation
Claude Code stores OAuth credentials in macOS Keychain and intentionally deletes the plain text ~/.claude/.credentials.json file for security. This is documented behavior since Claude Code v1.0.5. This change adds Keychain fallback to ClaudeOAuthStorage.load(): - Try reading from file first (all platforms, manual setups) - Fall back to macOS Keychain using `security` command - Log which source was used for debugging Fixes credential loading on macOS where the file doesn't exist. Reference: anthropics/claude-code#1414 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Break long list in subprocess.run() call to stay within 88-char limit. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…tial storage Replace subprocess-based macOS Keychain access with the keyring library, enabling cross-platform support for macOS Keychain, Windows Credential Manager, and Linux Secret Service. Adds comprehensive unit tests for the keychain functionality.
Owner
Refactored to use
|
Ensures keyring is installed during CI type checking so mypy can resolve the import in oauth_claude storage module.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add macOS Keychain fallback to
ClaudeOAuthStorage.load()for reading Claude OAuth credentials.Problem
Claude Code stores OAuth credentials in macOS Keychain and intentionally deletes the plain text
~/.claude/.credentials.jsonfile for security. This is documented behavior since v1.0.5:As a result, CCProxy fails to load credentials on macOS:
Solution
~/.claude/.credentials.jsonfirst (existing behavior)securitycommand"Claude Code-credentials"(same as Claude Code)source=fileorsource=keychain)Changes
_read_from_macos_keychain()async helper functionClaudeOAuthStorage.load()to try Keychain when file is missingDarwin)Testing
Tested locally on macOS with:
~/.claude/.credentials.jsonsecurity find-generic-password -s "Claude Code-credentials" -wclaude_oauth_credentials_loaded_from_keychainReferences
🤖 Generated with Claude Code