Skip to content

feat(connectors): add OAuth flow handling with browser redirect and polling#192

Open
Paveltarno wants to merge 1 commit intopavelta-connectors-push-logicfrom
pavelta-connectors-4
Open

feat(connectors): add OAuth flow handling with browser redirect and polling#192
Paveltarno wants to merge 1 commit intopavelta-connectors-push-logicfrom
pavelta-connectors-4

Conversation

@Paveltarno
Copy link
Contributor

@Paveltarno Paveltarno commented Feb 4, 2026

Note

Description

This PR adds OAuth flow handling for connectors with browser-based authentication. It introduces a new runOAuthFlow function that opens the OAuth redirect URL in the user's browser and polls the backend API to check the authentication status until it completes (ACTIVE), fails (FAILED), or times out after 5 minutes (PENDING).

Related Issue

None

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • Created src/core/resources/connector/oauth.ts with runOAuthFlow function that orchestrates the OAuth authentication flow
  • Opens OAuth redirect URL in the user's browser using the open package
  • Polls getOAuthStatus API endpoint every 2 seconds until status changes from PENDING
  • Returns PENDING status if polling times out after 5 minutes (using p-wait-for with TimeoutError handling)
  • Renamed OAuthPollingStatus to ConnectorOAuthStatus for consistency
  • Exported OAuth flow utilities from connector module index
  • Added comprehensive unit tests covering successful OAuth, failed OAuth, and polling behavior

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated AGENTS.md if I made architectural changes

Additional Notes

This PR builds on the existing connector infrastructure (schemas, API client, push logic) by adding the final piece needed for OAuth-based connector authentication. The polling mechanism uses p-wait-for for clean timeout handling and returns a structured result indicating both the connector type and final OAuth status.


🤖 Generated by Claude | 2026-02-04 12:25 UTC

…olling

Add runOAuthFlow function that:
- Opens OAuth redirect URL in browser
- Polls getOAuthStatus until ACTIVE or FAILED
- Returns PENDING on timeout (5 minutes)

Uses p-wait-for TimeoutError for robust timeout detection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Paveltarno Paveltarno changed the title feat(connectors): add OAuth flow handling with browser redirect and p… feat(connectors): add OAuth flow handling with browser redirect and polling Feb 4, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.28-pr.192.c5ee3c5

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.0.28-pr.192.c5ee3c5"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.28-pr.192.c5ee3c5"
  }
}

Preview published to npm registry — try new features instantly!

@claude
Copy link

claude bot commented Feb 4, 2026


Code review

No issues found. Checked for bugs and CLAUDE.md compliance.


@kfirstri kfirstri moved this from Backlog to In progress in CLI Development Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

1 participant