Skip to content

Add OAuth token fallback for provider auth#268

Open
MegaDigitalCode wants to merge 1 commit intoRightNow-AI:mainfrom
MegaDigitalCode:feat/provider-oauth-auth-fallback
Open

Add OAuth token fallback for provider auth#268
MegaDigitalCode wants to merge 1 commit intoRightNow-AI:mainfrom
MegaDigitalCode:feat/provider-oauth-auth-fallback

Conversation

@MegaDigitalCode
Copy link

@MegaDigitalCode MegaDigitalCode commented Mar 3, 2026

Summary

This PR adds provider credential fallback support for OAuth-style tokens in OpenFang runtime auth resolution and provider auth status detection.

What Changed

  • Add env candidate resolution helper for provider credentials.
  • Update driver credential resolution to support OAuth token fallbacks:
    • anthropic: ANTHROPIC_OAUTH_TOKEN then ANTHROPIC_API_KEY
    • qwen: QWEN_OAUTH_TOKEN then DASHSCOPE_API_KEY
    • minimax: MINIMAX_OAUTH_TOKEN then MINIMAX_API_KEY
  • Update detect_auth() to mark providers as configured when those OAuth env vars are present.
  • Update provider docs to mention OAuth token alternatives.
  • Add focused tests for both runtime credential resolution and auth-status detection paths.

Why

Some providers support OAuth-derived tokens in addition to static API keys. This change aligns runtime behavior and auth-status UX with those supported auth modes.

Validation

Executed on runner environment:

  • cargo test -p openfang-runtime
  • Focused tests for new coverage:
    • test_detect_auth_anthropic_oauth_token
    • test_detect_auth_qwen_oauth_token
    • test_detect_auth_minimax_oauth_token
    • test_resolve_provider_api_key_prefers_anthropic_oauth
    • test_resolve_provider_api_key_qwen_oauth_fallback
    • test_resolve_provider_api_key_minimax_oauth_fallback
  • cargo clippy -p openfang-runtime --all-targets -- -D warnings

Scope

Single concern only: provider auth fallback behavior plus matching docs/tests.

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