mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix: recognize Claude Code OAuth tokens (cc- prefix) in _is_oauth_token
Fixes NousResearch/hermes-agent#9813 Root cause: _is_oauth_token() only recognized sk-ant-* and eyJ* patterns, but Claude Code OAuth tokens from CLAUDE_CODE_OAUTH_TOKEN use cc- prefix Fix: Add cc- prefix detection so these tokens route through Bearer auth
This commit is contained in:
parent
56086e3fd7
commit
5383615db5
1 changed files with 5 additions and 1 deletions
|
|
@ -277,8 +277,9 @@ def _is_oauth_token(key: str) -> bool:
|
|||
Positively identifies Anthropic OAuth tokens by their key format:
|
||||
- ``sk-ant-`` prefix (but NOT ``sk-ant-api``) → setup tokens, managed keys
|
||||
- ``eyJ`` prefix → JWTs from the Anthropic OAuth flow
|
||||
- ``cc-`` prefix → Claude Code OAuth access tokens (from CLAUDE_CODE_OAUTH_TOKEN)
|
||||
|
||||
Non-Anthropic keys (MiniMax, Alibaba, etc.) don't match either pattern
|
||||
Non-Anthropic keys (MiniMax, Alibaba, etc.) don't match any pattern
|
||||
and correctly return False.
|
||||
"""
|
||||
if not key:
|
||||
|
|
@ -292,6 +293,9 @@ def _is_oauth_token(key: str) -> bool:
|
|||
# JWTs from Anthropic OAuth flow
|
||||
if key.startswith("eyJ"):
|
||||
return True
|
||||
# Claude Code OAuth access tokens (opaque, from CLAUDE_CODE_OAUTH_TOKEN)
|
||||
if key.startswith("cc-"):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue