claudewheel v0.20.1 /claudewheel.auth
Edit
On this page

Validate OAuth tokens against the Anthropic API and extract them from captured output.

#claudewheel.auth

#claudewheel.auth

Validate OAuth tokens against the Anthropic API and extract them from captured output.

#validate_token

python
def validate_token(token: str, timeout: float=5.0) -> str

Probe the Anthropic API with the token; return one of the four states.

Never logs, prints, or embeds the token in any raised exception.

#extract_token

python
def extract_token(captured: bytes) -> str | None

Scrape an OAuth token from raw PTY-captured terminal output.

Strips terminal escape sequences, joins lines (to defeat hard-wrapping mid-token), anchors the search after the last "valid for 1 year" label when present (Ink re-renders frames; the last frame wins), and applies a length sanity check. Returns the best candidate or None.

#_best_candidate

python
def _best_candidate(data: bytes) -> str | None

Pick the best token-looking match in data, or None.