White Label Integration

Create OAuth2 integrations where customers see your company name instead of Airweave, with automatic multi-tenant data isolation.

1. Create White Label Configuration

Set up your white label integration with your OAuth2 app credentials:

1from airweave import AirweaveSDK
2
3client = AirweaveSDK(api_key="YOUR_API_KEY")
4
5# Create white label integration
6integration = client.white_labels.create({
7 "name": "Customer Portal Integration",
8 "source_short_name": "google_drive",
9 "redirect_url": "https://yourapp.com/oauth/callback",
10 "client_id": "123456789-abc.apps.googleusercontent.com",
11 "client_secret": "GOCSPX-your-oauth-secret",
12 "allowed_origins": "https://yourapp.com,https://app.yourapp.com"
13})

2. Generate Customer Auth URLs

For each customer who wants to connect their account, generate an url to redirect them to:

1auth_url = client.white_labels.get_oauth2_auth_url(
2 white_label_id=integration.id,
3 state=customer_id # Your customer's unique identifier
4)

3. Handle OAuth Callback

When the customer completes OAuth, handle the callback:

1source_connection = client.white_labels.exchange_oauth2_code(
2 white_label_id=integration.id,
3 code=oauth_code,
4 source_connection_in={
5 "name": "Customer Google Drive",
6 "collection": "customer-data",
7 "sync_immediately": True
8 }
9)

Complete Integration Example

Here’s a full example showing how to integrate white labeling into a React application:

1import { useState } from 'react';
2import { Button } from '@/components/ui/button';
3import { ExternalLink } from 'lucide-react';
4
5interface ConnectServiceProps {
6 customerId: string;
7 integrationId: string;
8}
9
10export function ConnectService({ customerId, integrationId }: ConnectServiceProps) {
11 const [connecting, setConnecting] = useState(false);
12
13 const handleConnect = async () => {
14 try {
15 setConnecting(true);
16
17 // Get the branded OAuth URL
18 const response = await fetch(
19 `/api/integrations/${integrationId}/auth-url?customer=${customerId}`,
20 { headers: { 'Authorization': `Bearer ${apiKey}` } }
21 );
22
23 const { authUrl } = await response.json();
24
25 // Redirect to branded OAuth flow
26 window.location.href = authUrl;
27
28 } catch (error) {
29 console.error('Failed to initiate connection:', error);
30 } finally {
31 setConnecting(false);
32 }
33 };
34
35 return (
36 <Button
37 onClick={handleConnect}
38 disabled={connecting}
39 className="w-full"
40 >
41 {connecting ? (
42 'Connecting...'
43 ) : (
44 <>
45 Connect Google Drive <ExternalLink className="ml-2 h-4 w-4" />
46 </>
47 )}
48 </Button>
49 );
50}

Example Demo Application