feat: support OAuth token via JSON string flag (-tokenJSON)#217
Open
dandaka wants to merge 1 commit into
Open
Conversation
Add CacheString type that accepts OAuth tokens as JSON strings instead of requiring a file on disk. Refreshed tokens are written to stderr (default), stdout, or a file path via -tokenOut flag. This enables CI/CD pipelines and secret managers to avoid storing tokens on disk. Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Summary
CacheStringtype inoauth.gothat implements theCacheinterface using an in-memory JSON string instead of a file-tokenJSONflag to pass OAuth token as a JSON string (alternative to-cachefile)-tokenOutflag to control where refreshed tokens are written:stdout,stderr(default), or a file pathREFRESHED_TOKEN=for easy parsing by callersMotivation
Currently the tool requires a writable file (
-cache) to store and refresh OAuth tokens. This forces tokens to live on disk, which is a security concern for CI/CD pipelines, ephemeral environments, and setups using secret managers (Infisical, Vault, etc.).Usage
Breaking changes
None — purely additive. Existing
-cachebehavior is completely unchanged.Test plan
CacheString.Token()parses valid JSON tokenCacheString.Token()returns error on invalid JSONCacheString.PutToken()writes to stderr (explicit)CacheString.PutToken()writes to stderr (default when output is empty)CacheString.PutToken()writes to stdoutCacheString.PutToken()writes to filego build ./...succeedsgo test ./...passes🤖 Generated with Claude Code