feat(oauth): enhance Rowboat sign-in process to prevent duplicate users (#489)

* feat(oauth): enhance Rowboat sign-in process to prevent duplicate users

Added billing information checks during the Rowboat OAuth connection and onboarding process to ensure user and Stripe customer existence before proceeding. This change mitigates the risk of creating duplicate users due to parallel API calls. Updated error handling for better debugging in case of failures.

* refactor(onboarding): remove billing info check during Rowboat OAuth connection

Eliminated the billing information check that was previously in place to prevent duplicate Stripe customers during the onboarding process. This change simplifies the onboarding flow while maintaining the necessary checks for composio flags after account connection.
This commit is contained in:
Tushar 2026-04-13 18:15:04 +05:30 committed by GitHub
parent b3066a0b7a
commit 2653f6170d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,6 +11,7 @@ import { triggerSync as triggerGmailSync } from '@x/core/dist/knowledge/sync_gma
import { triggerSync as triggerCalendarSync } from '@x/core/dist/knowledge/sync_calendar.js';
import { triggerSync as triggerFirefliesSync } from '@x/core/dist/knowledge/sync_fireflies.js';
import { emitOAuthEvent } from './ipc.js';
import { getBillingInfo } from '@x/core/dist/billing/billing.js';
const REDIRECT_URI = 'http://localhost:8080/oauth/callback';
@ -271,6 +272,17 @@ export async function connectProvider(provider: string, credentials?: { clientId
triggerFirefliesSync();
}
// For Rowboat sign-in, ensure user + Stripe customer exist before
// notifying the renderer. Without this, parallel API calls from
// multiple renderer hooks race to create the user, causing duplicates.
if (provider === 'rowboat') {
try {
await getBillingInfo();
} catch (meError) {
console.error('[OAuth] Failed to initialize user via /v1/me:', meError);
}
}
// Emit success event to renderer
emitOAuthEvent({ provider, success: true });
} catch (error) {