Skip to content

feat(connections): extract shared OAuth flow and auto-authenticate from empty state#2543

Open
viktormarinho wants to merge 1 commit intomainfrom
feat/oauth-flow-extraction
Open

feat(connections): extract shared OAuth flow and auto-authenticate from empty state#2543
viktormarinho wants to merge 1 commit intomainfrom
feat/oauth-flow-extraction

Conversation

@viktormarinho
Copy link
Contributor

@viktormarinho viktormarinho commented Mar 2, 2026

Summary

  • Extract the full OAuth flow (popup → token save → query invalidation) from connection/index.tsx into authenticate-connection.ts — a shared helper usable by any component
  • connection/index.tsx: handleAuthenticate delegates to the helper (no behavior change)
  • no-llm-binding-empty-state.tsx: "Connect OpenRouter" now triggers OAuth immediately in a popup, staying on the Home page, instead of navigating away to the connection detail page

Test plan

  • Authenticate an existing connection from the connection detail page — still works
  • Click "Connect OpenRouter" from the empty chat state — OAuth popup opens, on success shows toast and model selector becomes available without navigating away
  • If an OpenRouter connection already exists but is unauthenticated, clicking the button re-triggers auth (doesn't create a duplicate)
  • Auth failure shows an error toast

Split from #2528

🤖 Generated with Claude Code


Summary by cubic

Extracted the OAuth flow into a shared helper and enabled one-click OpenRouter authentication from the empty chat state without leaving Home. This reduces duplication and refreshes UI state automatically after auth.

  • New Features

    • “Connect OpenRouter” now opens an OAuth popup in place; on success shows a toast and unlocks the model selector.
    • Reuses an existing OpenRouter connection when present; no duplicates.
    • Errors surface via toast.
  • Refactors

    • Moved full OAuth flow (popup → token save → query invalidation) to apps/mesh/src/web/lib/authenticate-connection.ts.
    • Connection detail view now delegates to the helper with no behavior change.

Written for commit 727aa37. Summary will update on new commits.

Extract the full OAuth flow (popup → token save → query invalidation) from
connection/index.tsx into a shared authenticateConnection() helper so it
can be reused across components.

- New: apps/mesh/src/web/lib/authenticate-connection.ts
- connection/index.tsx: handleAuthenticate now delegates to the helper
- no-llm-binding-empty-state.tsx: "Connect OpenRouter" now triggers
  OAuth immediately (stays on Home) instead of navigating to the
  connection detail page

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

🧪 Benchmark

Should we run the Virtual MCP strategy benchmark for this PR?

React with 👍 to run the benchmark.

Reaction Action
👍 Run quick benchmark (10 & 128 tools)

Benchmark will run on the next push after you react.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

Release Options

Should a new version be published when this PR is merged?

React with an emoji to vote on the release type:

Reaction Type Next Version
👍 Prerelease 2.123.5-alpha.1
🎉 Patch 2.123.5
❤️ Minor 2.124.0
🚀 Major 3.0.0

Current version: 2.123.4

Deployment

  • Deploy to production (triggers ArgoCD sync after Docker image is published)

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

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