Anthropic OAuth authentication with PKCE and auto-refresh - #76
Merged
Conversation
- Add support for `claude setup-token` as the Anthropic API Key - Add support for dynamic-thinking per router for supported models Clean up Revert quickstart
Log stop_reason and raw content array at debug level when the API returns a 200 but with no text or tool_use blocks.
Skip thinking blocks instead of discarding them, preventing empty response errors when model returns only thinking content.
- spacebot auth login: opens browser for Claude Pro/Max or Console OAuth, user pastes authorization code, tokens stored in anthropic_oauth.json - spacebot auth status/refresh/logout: manage stored credentials - LlmManager loads OAuth tokens on startup and auto-refreshes before API calls when the access token expires (5-minute buffer) - OAuth tokens take priority over static ANTHROPIC_API_KEY from .env - Onboarding flow offers OAuth as an alternative to manual API key entry - Fix EnvGuard in tests to clear all provider env vars, add OAuth test
Contributor
|
Neat! I went down this route initially but cut it for scope as I had limited time, this makes sense and is a great UX improvement. |
cloudrumbles
added a commit
to cloudrumbles/spacebot
that referenced
this pull request
Feb 21, 2026
Cherry-pick from upstream: 286d0aa (PR spacedriveapp#76)
rktmeister
pushed a commit
to rktmeister/spacebot
that referenced
this pull request
Mar 11, 2026
Anthropic OAuth authentication with PKCE and auto-refresh
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.
Builds on @egenvall's Claude Code Token support (#32 ) and adds full OAuth lifecycle management.
What this adds:
spacebot auth login— PKCE OAuth flow (opens browser, user pastes code, tokens stored inanthropic_oauth.json)spacebot auth status/refresh/logout— credential management CLIspacebot auth loginoffered alongside manual API key entry during first-run setupanthropic-beta: oauth-2025-04-20,user-agent: claude-code/2.1.49,?beta=truequery param, tool namemcp_prefix/deprefixAlso includes fixes from @egenvall's branch:
claude-cli→claude-code) which caused 403s