feat(auth): sync OAuth credentials from Claude CLI and Codex CLI#374
Closed
pepicrft wants to merge 1 commit intoopenclaw:mainfrom
Closed
feat(auth): sync OAuth credentials from Claude CLI and Codex CLI#374pepicrft wants to merge 1 commit intoopenclaw:mainfrom
pepicrft wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Automatically read OAuth tokens from Claude CLI (~/.claude/.credentials.json) and Codex CLI (~/.codex/auth.json) and sync them into clawdbot's auth store. This solves the 'refresh_token_reused' issue when multiple tools share the same OAuth credentials - since refresh tokens are single-use, when Claude CLI or Codex CLI refreshes the token, clawdbot's stored refresh token becomes invalid. Now clawdbot will automatically pick up fresh tokens from CLI tools on every auth store load, eliminating the need for manual syncing or re-authentication. Fixes openclaw#323
Contributor
|
ohh we can just do that!? dayyymn. Need to think how this fits into multi-oauth, but all possible! |
Contributor
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
~/.claude/.credentials.json) and Codex CLI (~/.codex/auth.json)Problem
OAuth refresh tokens are single-use. When Claude CLI, Codex CLI, and Clawdbot all share the same OAuth credentials but store them separately, the first tool to refresh invalidates the others' stored refresh tokens. This causes persistent "OAuth token refresh failed" errors.
Solution
Instead of maintaining separate credential copies, clawdbot now reads directly from CLI credential files:
~/.claude/.credentials.jsonfor Anthropic OAuth~/.codex/auth.jsonfor OpenAI Codex OAuthOn every auth store load, clawdbot checks if CLI tools have fresher tokens and syncs them automatically.
Test plan
Fixes #323
🤖 Generated with Claude Code