Cloud Connectors (Nango)
Connect ChatRAG to your cloud storage providers and sync documents directly into your RAG knowledge base. Powered by Nango for secure OAuth integrations.
Supported Providers
✅ Google Drive✅ Notion✅ Dropbox
How It Works
┌─────────────────────────────────────────────────────────────┐
│ User's Browser │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ ChatRAG Documents Dashboard │ │
│ │ - Connect provider buttons │ │
│ │ - Folder/file pickers │ │
│ │ - Sync controls │ │
│ └────────────────────────┬────────────────────────────┘ │
└───────────────────────────│─────────────────────────────────┘
│ OAuth via Nango
▼
┌─────────────────────────────────────────────────────────────┐
│ Nango Cloud │
│ - Secure token storage │
│ - OAuth flow management │
│ - API proxy & rate limiting │
└────────────────────────────┬────────────────────────────────┘
│
┌────────────────────┼────────────────────┐
▼ ▼ ▼
┌───────────────┐ ┌───────────────┐ ┌───────────────┐
│ Google Drive │ │ Notion │ │ Dropbox │
└───────────────┘ └───────────────┘ └───────────────┘Nango handles OAuth flows, token refresh, and API proxying - ChatRAG never stores your provider credentials.
Quick Start
Step 1: Get Nango API Key
- Sign up at app.nango.dev
- Go to Environment Settings → API Keys
- Copy your Secret Key
Step 2: Configure Environment
# Add to your .env.local
NEXT_PUBLIC_NANGO_ENABLED=true
NANGO_SECRET_KEY=your_secret_key_here
NANGO_WEBHOOK_SECRET=your_webhook_secret
NANGO_HOST=https://api.nango.devStep 3: Install Dependencies
npm install @nangohq/node @nangohq/frontendStep 4: Connect a Provider
- Navigate to Documents dashboard in ChatRAG
- Click "Connect" on Google Drive, Notion, or Dropbox
- Complete OAuth flow in the popup
- Select folders/files to sync
- Click "Sync" to import documents
Provider Setup (Production)
For production, configure your own OAuth credentials for each provider. For development, Nango provides shared credentials.
Google Drive
1. Create Google Cloud Project
- Go to console.cloud.google.com
- Create new project named "ChatRAG"
- Enable Google Drive API
- Configure OAuth consent screen (External)
- Create OAuth 2.0 credentials (Web application)
2. Set Redirect URI
https://api.nango.dev/oauth/callback
3. Configure in Nango Dashboard
Paste Client ID and Secret in Nango → Integrations → google-drive
Notion
1. Create Notion Integration
- Go to notion.so/my-integrations
- Create new integration named "ChatRAG"
- Enable "Read content" capability
2. Enable OAuth
- Go to Distribution tab
- Enable OAuth 2.0
- Add redirect URI:
https://api.nango.dev/oauth/callback
3. Configure in Nango Dashboard
Copy Client ID and Secret to Nango → Integrations → notion
Notion supports dual-mode selection: top-level pages OR specific subpages with up to 5 levels of nesting.
Dropbox
1. Create Dropbox App
- Go to dropbox.com/developers/apps
- Create App → Scoped access → Full Dropbox
- Name: "ChatRAG Integration"
2. Configure Permissions
✓ files.metadata.read ✓ files.content.read
3. Set Redirect URI
https://api.nango.dev/oauth/callback
Environment Variables Reference
| Variable | Required | Description |
|---|---|---|
NEXT_PUBLIC_NANGO_ENABLED | ✓ | Enable/disable Nango feature |
NANGO_SECRET_KEY | ✓ | Backend secret key from Nango dashboard |
NANGO_WEBHOOK_SECRET | Webhook signature verification | |
NANGO_HOST | API endpoint (default: https://api.nango.dev) | |
NEXT_PUBLIC_CONNECTORS_ENABLED | Enable connectors system | |
CONNECTORS_SHOW_ON_DASHBOARD | Show connectors on Document Dashboard | |
NANGO_SYNC_INTERVAL_HOURS | Auto-sync interval (0 = manual only) | |
NANGO_MAX_FILES_PER_SYNC | Maximum files per sync batch (default: 100) |
Admin Configuration
Admins can manage connectors through the Configuration Dashboard without code changes.
Access Config Dashboard
npm run config
# Open http://localhost:3333
# Navigate to "🔗 Connectors" tabAvailable Controls
- Enable/Disable Connectors: Toggle entire feature on/off
- Dashboard Visibility: Show/hide connectors section
- Per-Provider Settings: Enable/disable individual providers
- Connection Statistics: View connected users, sync rates
- Reset to Defaults: Restore default provider configuration
Document Sync Workflow
- User clicks "Sync" on a connected provider
- Backend fetches file list from provider via Nango proxy
- For each file:
- Download content via Nango
- Parse with LlamaCloud
- Generate embeddings with OpenAI
- Store in Supabase with vector indexes
- Track in
nango_sync_recordstable - Return sync statistics (added, updated, deleted, failed)
Troubleshooting
"Failed to create connect session"
- Check
NEXT_PUBLIC_NANGO_ENABLED=true - Verify NANGO_SECRET_KEY matches your Nango dashboard
- Ensure you're logged in to ChatRAG
- Check provider is configured in Nango integrations
Sync succeeded but no documents appeared
- Verify folder contains files (not empty)
- Check file types are supported (PDF, DOC, DOCX, TXT)
- Ensure you have read access to the files
- Check LlamaCloud/OpenAI API logs for parsing errors
Connection disconnects after ~1 hour
- This happens with Nango-provided development credentials
- Solution: Configure your own OAuth credentials for production
- See Provider Setup section above
Notion pages show flat list (no hierarchy)
- API filtering may not be working correctly
- Check browser Network tab:
/api/nango/notion/pages?mode=root - Verify response includes correct parent types
Debug Commands
# Test Nango connection
node scripts/diagnose-nango-oauth.js
# Check connector configuration
curl http://localhost:3000/api/config/connectors | jq .
# List enabled providers only
curl http://localhost:3000/api/config/connectors | \
jq '.providers[] | select(.enabled == true) | .provider'
# View sync diagnostics
node scripts/diagnose-nango-sync.jsConnector Features
- Multi-Device Support: OAuth tokens managed by Nango
- Session Persistence: Stay connected across restarts
- Incremental Sync: Only re-process modified files
- Admin Controls: Enable/disable providers per-user
- Vector Search: Synced documents fully integrated with RAG