Skip to main content
Integrate the Sync2Books Link component to connect accounting systems (QuickBooks, Xero, Sage) in your application.

Overview

The Sync2Books Link is a pre-built UI component that handles the OAuth flow for connecting accounting systems. It provides:
  • Pre-built UI - No need to build OAuth flows yourself
  • Multi-framework support - React, Vue, Angular, Svelte
  • Customizable branding - Use your app’s logo and name
  • Automatic token management - Handles refresh and expiration
This page describes the OAuth flow (QuickBooks, Xero, Sage). Odoo doesn’t use OAuth — the Link modal instead shows a credentials form (URL, database, username, API key) directly inside the same widget. See Set up the Odoo integration for that flow specifically; everything else on this page (installation, useSync2Books, error handling) applies the same way regardless of which integration is selected.

Prerequisites

  • API Key - Your application’s API key
  • Application ID - Your application ID
  • Company ID - The company/user ID in your system
  • Redirect URIs - Configured in your application settings

React Integration

Installation

Basic Usage

Advanced Usage

API Reference

useSync2Books(config)

Config Options: Returns:
  • openLink(args?) - Function to open the Link modal
  • isReady - Boolean indicating if Link is ready
  • isInitiated - Boolean indicating if Link has been initialized

Vue Integration

Installation

Basic Usage

Advanced Usage

Angular Integration

Installation

Basic Usage

Svelte Integration

Installation

Basic Usage

Customization

Application Settings

Configure your application’s Link appearance in the dashboard:
  1. Go to ApplicationsSettings
  2. Set Link Logo URL - Your app’s logo (shown in OAuth consent)
  3. Set Link Display Name - Your app’s name (shown in OAuth consent)
  4. Add Redirect URIs - URLs where users are redirected after OAuth

Redirect URIs

Redirect URIs must be configured in your application settings. Examples:
  • http://localhost:3000/callback
  • https://app.example.com/callback
  • https://app.example.com/application/{applicationId}/connect
After successful OAuth, users are redirected to the first matching URI from your configured list.

Error Handling

User Recoverable Errors

Some errors allow users to retry:

Common Errors

Best Practices

  1. Show loading state - Disable buttons until isReady is true
  2. Handle errors gracefully - Show user-friendly error messages
  3. Store connection ID - Save connectionId after successful connection
  4. Test redirect URIs - Ensure redirect URIs are correctly configured
  5. Use production API keys - Use sk_production_... keys in production
The Link component shows a modal/dialog with the following steps:

Step 1: Integration Selection

The user sees a searchable list of available integrations:
After selecting an integration, a new tab/window opens with the accounting system’s OAuth consent page (e.g., QuickBooks). The modal shows:

Step 3: Success

After successful OAuth, the modal shows:

Customization

The Link component can be customized via your application settings:
  • Logo - Set linkLogoUrl to show your app’s logo in the OAuth consent screen
  • Display Name - Set linkDisplayName to show your app’s name (e.g., “Your App Name”)
  • Redirect URIs - Configure where users are redirected after OAuth completes

Next Steps