Skip to content

feat: add AuthData::BearerToken for OAuth Bearer auth#5

Merged
AlexMikhalev merged 1 commit intomainfrom
feature/bearer-token-auth
Feb 8, 2026
Merged

feat: add AuthData::BearerToken for OAuth Bearer auth#5
AlexMikhalev merged 1 commit intomainfrom
feature/bearer-token-auth

Conversation

@AlexMikhalev
Copy link

Summary

  • Add BearerToken(String) variant to AuthData enum for OAuth Bearer token authentication
  • When the Anthropic adapter sees a BearerToken, it uses Authorization: Bearer header instead of x-api-key
  • Enables terraphim-llm-proxy to use Claude OAuth tokens for Anthropic API requests while reusing all format conversion and streaming logic

Changes

  • src/resolver/auth_data.rs: Add BearerToken variant, handle in single_key_value() and Debug impl, add 4 unit tests
  • src/adapter/adapters/anthropic/adapter_impl.rs: Match on BearerToken to switch auth header format

Test plan

  • 4 new unit tests for BearerToken variant (single_key_value, debug redaction, existing key/override behavior)
  • cargo check passes
  • All existing tests unaffected

Closes terraphim/terraphim-llm-proxy#97

Generated with Claude Code

Add BearerToken(String) variant to AuthData enum to support OAuth
Bearer token authentication. When the Anthropic adapter sees a
BearerToken, it uses Authorization: Bearer header instead of x-api-key.

This enables terraphim-llm-proxy to use Claude OAuth tokens for
Anthropic API requests while reusing all format conversion and
streaming logic.

Changes:
- auth_data.rs: Add BearerToken variant, handle in single_key_value()
  and Debug impl, add 4 unit tests
- adapter_impl.rs: Match on BearerToken to use Bearer auth header

Closes terraphim/terraphim-llm-proxy#97

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@AlexMikhalev AlexMikhalev merged commit 433e559 into main Feb 8, 2026
1 check failed
AlexMikhalev added a commit that referenced this pull request Mar 16, 2026
AuthData::None now returns an empty string from single_key_value()
instead of erroring, matching the behaviour of RequestOverride for
no-auth providers. Added tests for None variant and MultiKeys error case.

Refs #5

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant