Skip to content

feat: add OAuth device-flow providers (Codex, Gemini, Qwen, MiniMax) with vault token persistence#1115

Open
AlexZander85 wants to merge 2 commits intoRightNow-AI:mainfrom
AlexZander85:feature/oauth-vault
Open

feat: add OAuth device-flow providers (Codex, Gemini, Qwen, MiniMax) with vault token persistence#1115
AlexZander85 wants to merge 2 commits intoRightNow-AI:mainfrom
AlexZander85:feature/oauth-vault

Conversation

@AlexZander85
Copy link
Copy Markdown
Contributor

Summary

  • Add persist_oauth_secret / persist_oauth_tokens helpers for secure token storage (credential vault + secrets.env + env var)
  • Fix GeminiFlowState: persist SlowDown interval update in DashMap (matching Copilot/Codex pattern)
  • Return status-only JSON on OAuth completion (no raw tokens in response body) for Codex, Gemini, Qwen
  • Fix Qwen poll error status: pending -> error when qwen_poll_oauth_flow() returns Err
  • Version bump 0.5.7 -> 0.5.9, add .ag/ and .beads/ to .gitignore

Changed files

  • .gitignore - add .ag/logs/, .beads/
  • Cargo.toml / Cargo.lock - version 0.5.7 -> 0.5.9
  • crates/openfang-api/src/routes.rs - persist_oauth helpers, Gemini interval fix, token persistence in poll handlers

Test plan

  • cargo build --workspace --lib - compiles clean
  • cargo test -p openfang-api -p openfang-runtime -p openfang-types - all 910+ tests pass
  • cargo clippy --workspace --all-targets -- -D warnings - zero warnings

Part of #1030 OAuth providers review split (PR 1 of 3)

…with vault token persistence

Adds a new oauth_providers module with device-flow implementations for
OpenAI Codex, Google Gemini, Qwen (DashScope), and MiniMax. Tokens are
persisted to both the in-memory vault and secrets.env for dual-write
durability. The Copilot flow is preserved unchanged.

New routes:
  POST /api/providers/openai-codex/oauth/start
  GET  /api/providers/openai-codex/oauth/poll/{poll_id}
  POST /api/providers/gemini-oauth/oauth/start
  GET  /api/providers/gemini-oauth/oauth/poll/{poll_id}
  POST /api/providers/qwen-oauth/oauth/start
  GET  /api/providers/qwen-oauth/oauth/poll/{poll_id}
  POST /api/providers/minimax-oauth/oauth/start
  GET  /api/providers/minimax-oauth/oauth/poll/{poll_id}

UI: Settings page shows Login buttons for each provider with device-code
display and polling feedback.
… OAuth routes

- Add allow_no_auth to AuthConfig (default true) for backward compatibility
- Replace fail-open with fail-close+opt-in: when allow_no_auth=false and no API
  key is set, return 401 instead of allowing all access (RightNow-AI#1034)
- Add codex/gemini/qwen/minimax OAuth routes to middleware public endpoint list
- Add auth middleware unit 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