feat: add anthropic oauth authentication to claude code sdk (#2)#14
Open
acebytes wants to merge 1 commit intoinstantlyeasy:authfrom
Open
feat: add anthropic oauth authentication to claude code sdk (#2)#14acebytes wants to merge 1 commit intoinstantlyeasy:authfrom
acebytes wants to merge 1 commit intoinstantlyeasy:authfrom
Conversation
* feat: Add programmatic authentication support via OAuth flow - Implement OAuth PKCE authentication flow based on opencode implementation - Add ClaudeAuth and AnthropicAuth classes for programmatic auth - Store credentials securely in ~/.claude/credentials.json with 600 permissions - Automatic token refresh when expired - Complete auth example with interactive flow - Export auth functions: startAuth, isAuthenticated, getAccessToken, logout - Add comprehensive test coverage for auth functionality - Update README with detailed authentication documentation Resolves instantlyeasy#10 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: yolocode-ai <yolocodeai@users.noreply.github.com> * feat: implement Anthropic auth flow with OpenAuth.js * refactor: move auth flow to auth directory and simplify implementation * refactor: extract auth storage interface and implement file-based storage * feat: store OAuth credentials in file storage after token exchange * refactor: simplify auth flow by separating token refresh from storage - renamed AuthAnthropic.access() to refresh() for clarity - removed storage dependency from refresh method - moved token storage logic to auth-example.ts - refresh now only handles token refresh, not storage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: add in-memory authentication example - new example that doesn't use filesystem storage - outputs credentials directly to stdout - demonstrates token refresh functionality - useful for temporary auth or CI/CD environments 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: update import paths to use published npm package instead of local source * chore: remove unused dependencies (crypto, node-fetch) removed packages that are not actually used in the implementation: - crypto: using node's built-in crypto module - node-fetch: using native fetch api 🤖 generated with [claude code](https://claude.ai/code) co-authored-by: claude <noreply@anthropic.com> * refactor: remove AuthFileStorage, keep validation helpers - removed AuthFileStorage class for manual storage handling - kept zod validation schemas as exported helpers - updated auth-example.ts to use manual file operations - exported OAuthCredentials, validateCredentials, isValidCredentials 🤖 generated with [claude code](https://claude.ai/code) co-authored-by: claude <noreply@anthropic.com> --------- Co-authored-by: yolocode-ai <yolocodeai@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
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.
Resolves #10
🤖 Generated with Claude Code
feat: implement Anthropic auth flow with OpenAuth.js
refactor: move auth flow to auth directory and simplify implementation
refactor: extract auth storage interface and implement file-based storage
feat: store OAuth credentials in file storage after token exchange
refactor: simplify auth flow by separating token refresh from storage
🤖 Generated with Claude Code
🤖 Generated with Claude Code
refactor: update import paths to use published npm package instead of local source
chore: remove unused dependencies (crypto, node-fetch)
removed packages that are not actually used in the implementation:
🤖 generated with claude code
🤖 generated with claude code