-
Notifications
You must be signed in to change notification settings - Fork 929
Comparing changes
Open a pull request
base repository: anthropics/claude-agent-sdk-python
base: main
head repository: frograms/claude-agent-sdk-python
compare: oauth
- 8 commits
- 11 files changed
- 2 contributors
Commits on Mar 30, 2026
-
Claude Max 사용자가 API 키 없이 로그인된 토큰으로 SDK를 사용할 수 있도록 OAuth 인증 시스템을 구현했습니다. 주요 기능: - AuthProvider 추상화로 확장 가능한 인증 아키텍처 - OAuth 인증 (macOS Keychain + 파일 기반) - API 키 인증 (ANTHROPIC_API_KEY fallback) - 자동 감지 및 우선순위 적용 (OAuth → API 키) - logging 모듈 사용으로 일관된 출력 관리 - 의존성 주입으로 테스트 가능성 확보 구현 세부사항: - _errors.py: AuthenticationError 에러 타입 추가 - _internal/auth/: 인증 모듈 생성 - provider.py: AuthProvider 추상 클래스 - oauth.py: OAuthProvider 구현 (Keychain/파일 지원) - apikey.py: APIKeyProvider 구현 - __init__.py: create_auth_provider 팩토리 + get_oauth_status 헬퍼 - _internal/client.py: InternalClient에 AuthProvider 통합 - __init__.py: AuthenticationError, get_oauth_status export 추가 - tests/test_auth_provider.py: 12개 단위 테스트 추가 테스트 결과: - 12개 새 테스트 모두 통과 ✅ - 114개 기존 테스트 모두 통과 ✅ - 총 126개 테스트 성공 ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b605fc2 - Browse repository at this point
Copy the full SHA b605fc2View commit details -
개선: OAuth 사용 시 ANTHROPIC_API_KEY 자동 제거
Claude CLI의 인증 우선순위에서 ANTHROPIC_API_KEY가 OAuth보다 우선하므로, OAuth를 사용할 때는 API 키를 환경변수에서 제거하여 OAuth 인증이 확실히 사용되도록 개선했습니다. 변경사항: - OAuthProvider.prepare()에 API 키 제거 로직 추가 - 제거 시 debug 로그 출력 - docstring 업데이트 테스트 결과: - API 키 있는 상태에서도 OAuth 우선 사용 확인 ✅ - 실제 쿼리 정상 동작 확인 ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8a89d3a - Browse repository at this point
Copy the full SHA 8a89d3aView commit details -
수정: ClaudeSDKClient에 OAuth 인증 통합
ClaudeSDKClient는 InternalClient를 사용하지 않고 직접 Transport를 생성하기 때문에, connect() 메서드에 별도로 인증 로직을 추가했습니다. 변경사항: - ClaudeSDKClient.connect()에 create_auth_provider() 추가 - auth_provider.prepare() 호출로 OAuth 우선 사용 - API 키 자동 제거 로직 적용 테스트 결과: - ClaudeSDKClient도 OAuth 우선 사용 확인 ✅ - 126개 전체 테스트 통과 ✅ - query()와 ClaudeSDKClient 모두 OAuth 작동 ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 932ac81 - Browse repository at this point
Copy the full SHA 932ac81View commit details -
문서: README에 OAuth 브랜치 사용 방법 추가
다른 프로젝트에서 OAuth 브랜치를 사용하는 방법을 한국어로 안내: - pyproject.toml 설정 예시 (git branch 지정) - uv sync로 설치하는 방법 - uv sync --upgrade로 업데이트하는 방법 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ac63061 - Browse repository at this point
Copy the full SHA ac63061View commit details -
수정: OAuth 모듈 타입 힌트 추가 및 의존성 업데이트
- oauth.py에 dict[str, Any] 타입 명시로 mypy 에러 수정 - uv.lock 버전 동기화 (0.1.18) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for cde3ec0 - Browse repository at this point
Copy the full SHA cde3ec0View commit details -
- open() → Path.open() 변경 - IOError → OSError 변경 - 중첩 with문을 단일 with문으로 통합 Co-Authored-By: Claude Opus 4.5 <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8a36b4f - Browse repository at this point
Copy the full SHA 8a36b4fView commit details -
기능: CLAUDE_CODE_OAUTH_TOKEN 환경변수 지원 (long-lived token)
`claude setup-token`으로 발급한 장기 토큰을 CLAUDE_CODE_OAUTH_TOKEN 환경변수로 설정하면 SDK가 인식하여 CLI에 전달합니다. raw 문자열(sk-ant-oat01-...)과 JSON 형식 모두 지원합니다. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4ae270f - Browse repository at this point
Copy the full SHA 4ae270fView commit details -
문서: README에 long-lived token 인증 방법 추가
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9c7ae7f - Browse repository at this point
Copy the full SHA 9c7ae7fView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff main...oauth