OAuth Fixes - Batch Implementation Plan
**Status:** Session 4 Complete - 15/39 integrations (38%)
**Date:** 2026-04-15
**Goal:** Complete remaining 24 integrations
Quick Wins - Can Be Batched
Category 1: OAuth Configs Exist, Just Need Routes (5 integrations)
These have OAuth configs in oauth_handler.py but need callback routes implemented:
| Integration | OAuth Config | Routes File | Est. Time |
|---|---|---|---|
| **Asana** | ✅ ASANA_OAUTH_CONFIG | asana_routes.py | 20 min |
| **Airtable** | ✅ AIRTABLE_OAUTH_CONFIG | airtable_routes.py | 20 min |
| **Linear** | ✅ LINEAR_OAUTH_CONFIG | linear_routes.py | 20 min |
| **ClickUp** | ✅ CLICKUP_OAUTH_CONFIG | clickup_routes.py | 20 min |
| **Box** | ✅ BOX_OAUTH_CONFIG | box_routes.py | 20 min |
**Implementation Pattern:**
# Add to routes file
@router.post("/callback")
async def handle_oauth_callback(
payload: OAuthCallbackRequest,
current_tenant: Tenant = Depends(get_current_tenant),
current_user: User = Depends(get_current_user),
db: Session = Depends(get_db),
):
from core.oauth_handler import [PROVIDER]_OAUTH_CONFIG, OAuthHandler
from core.oauth_utils import trigger_historical_sync_on_connection
oauth_handler = OAuthHandler([PROVIDER]_OAUTH_CONFIG)
token_data = await oauth_handler.exchange_code_for_tokens(payload.code)
# Save to IntegrationToken + OAuthToken
# Trigger 3-month historical syncCategory 2: Google/Microsoft Integrations (4+ integrations)
These use existing OAuth configs but are separate products:
| Integration | OAuth Config | Est. Time |
|---|---|---|
| **Gmail** | GOOGLE_OAUTH_CONFIG | 15 min |
| **Google Chat** | GOOGLE_OAUTH_CONFIG | 15 min |
| **Google Drive** | GOOGLE_OAUTH_CONFIG | 15 min |
| **Outlook** | MICROSOFT_OAUTH_CONFIG | 15 min |
**Note:** Can reuse Google Calendar / Microsoft patterns already implemented.
Category 3: API Key Auth (No OAuth Needed)
These don't use OAuth - they use API keys:
| Integration | Auth Type | Action |
|---|---|---|
| **SendGrid** | API Key | ✅ Already documented, no OAuth needed |
| **Stripe** | API Key | Mark as N/A in progress doc |
| **OpenAI** | API Key | Mark as N/A in progress doc |
Category 4: Need Investigation (10+ integrations)
These need OAuth implementation from scratch:
| Integration | Complexity | Est. Time | Notes |
|---|---|---|---|
| **Trello** | Medium | 30 min | Needs OAuth config + routes |
| **Xero** | High | 45 min | Complex OAuth flow |
| **Shopify** | Medium | 30 min | Needs OAuth config + routes |
| **Zendesk** | Medium | 30 min | Needs OAuth config + routes |
| **QuickBooks** | High | 45 min | Complex OAuth flow |
| **Plaid** | High | 60 min | Complex financial OAuth |
| **Spotify** | Low | 20 min | Has OAuth config, no routes |
| **Canva** | Medium | 30 min | Has OAuth config, no routes |
| **Calendly** | Medium | 30 min | Needs investigation |
| **Zoho Books** | High | 45 min | Complex OAuth flow |
Batch Implementation Order
Phase 5: Category 1 Quick Wins (1.5 hours)
- Asana (20 min)
- Airtable (20 min)
- Linear (20 min)
- ClickUp (20 min)
- Box (20 min)
**Target:** 20/39 integrations (51%)
Phase 6: Category 2 Google/Microsoft (1 hour)
- Gmail (15 min)
- Google Chat (15 min)
- Google Drive (15 min)
- Outlook (15 min)
**Target:** 24/39 integrations (62%)
Phase 7: Category 4 - Medium Complexity (2.5 hours)
- Trello (30 min)
- Shopify (30 min)
- Zendesk (30 min)
- Spotify (20 min)
- Canva (30 min)
- Calendly (30 min)
**Target:** 30/39 integrations (77%)
Phase 8: Category 4 - High Complexity (3 hours)
- Xero (45 min)
- QuickBooks (45 min)
- Plaid (60 min)
- Zoho Books (45 min)
**Target:** 34/39 integrations (87%)
Phase 9: Final Cleanup (1 hour)
- Mark API key integrations as N/A
- Update documentation
- Final testing
- Create completion report
**Target:** 39/39 integrations (100%)
Session Summary
Session 4 Achievements
- ✅ 4 integrations fixed (Notion, Google Calendar, Monday.com, Figma)
- ✅ 15/39 total (38%)
- ✅ Established clear patterns for remaining work
Remaining Work
- 24 integrations need OAuth implementation
- Estimated 8-10 hours of focused work
- Clear path to 100% completion
Templates for Quick Implementation
Template 1: Add OAuth Callback to Existing Routes
# Add imports
from core.oauth_handler import PROVIDER_OAUTH_CONFIG, OAuthHandler
from core.oauth_utils import trigger_historical_sync_on_connection
@router.post("/callback")
async def handle_oauth_callback(
payload: OAuthCallbackRequest,
current_tenant: Tenant = Depends(get_current_tenant),
current_user: User = Depends(get_current_user),
db: Session = Depends(get_db),
):
"""Handle PROVIDER OAuth callback with token persistence and sync"""
oauth_handler = OAuthHandler(PROVIDER_OAUTH_CONFIG)
token_data = await oauth_handler.exchange_code_for_tokens(payload.code)
# Save tokens (use pattern from Figma/Notion)
# Trigger sync
return {"provider": "provider", "access_token": "...", "status": "active"}Template 2: Create OAuth Config (If Needed)
# In core/oauth_handler.py
PROVIDER_OAUTH_CONFIG = OAuthConfig(
provider_id="provider",
client_id=lambda: os.getenv("PROVIDER_CLIENT_ID"),
client_secret=lambda: os.getenv("PROVIDER_CLIENT_SECRET"),
redirect_uri=lambda: os.getenv("PROVIDER_REDIRECT_URI"),
scopes=["scope1", "scope2"],
authorization_url="https://provider.com/oauth/authorize",
token_url="https://provider.com/oauth/token",
)Next Steps
- **Start Phase 5** - Batch implement Category 1 quick wins
- **Use templates** - Copy patterns from Figma/Notion/Google Calendar
- **Test incrementally** - Commit after each integration
- **Update progress** - Keep docs/OAUTH_FIXES_PROGRESS.md current
**Estimated completion time:** 8-10 focused hours
**Target date:** 1-2 days of focused work
---
**Generated:** Session 4 Complete
**Next:** Phase 5 - Category 1 Quick Wins