ATOM Documentation

← Back to App

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:

IntegrationOAuth ConfigRoutes FileEst. Time
**Asana**✅ ASANA_OAUTH_CONFIGasana_routes.py20 min
**Airtable**✅ AIRTABLE_OAUTH_CONFIGairtable_routes.py20 min
**Linear**✅ LINEAR_OAUTH_CONFIGlinear_routes.py20 min
**ClickUp**✅ CLICKUP_OAUTH_CONFIGclickup_routes.py20 min
**Box**✅ BOX_OAUTH_CONFIGbox_routes.py20 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 sync

Category 2: Google/Microsoft Integrations (4+ integrations)

These use existing OAuth configs but are separate products:

IntegrationOAuth ConfigEst. Time
**Gmail**GOOGLE_OAUTH_CONFIG15 min
**Google Chat**GOOGLE_OAUTH_CONFIG15 min
**Google Drive**GOOGLE_OAUTH_CONFIG15 min
**Outlook**MICROSOFT_OAUTH_CONFIG15 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:

IntegrationAuth TypeAction
**SendGrid**API Key✅ Already documented, no OAuth needed
**Stripe**API KeyMark as N/A in progress doc
**OpenAI**API KeyMark as N/A in progress doc

Category 4: Need Investigation (10+ integrations)

These need OAuth implementation from scratch:

IntegrationComplexityEst. TimeNotes
**Trello**Medium30 minNeeds OAuth config + routes
**Xero**High45 minComplex OAuth flow
**Shopify**Medium30 minNeeds OAuth config + routes
**Zendesk**Medium30 minNeeds OAuth config + routes
**QuickBooks**High45 minComplex OAuth flow
**Plaid**High60 minComplex financial OAuth
**Spotify**Low20 minHas OAuth config, no routes
**Canva**Medium30 minHas OAuth config, no routes
**Calendly**Medium30 minNeeds investigation
**Zoho Books**High45 minComplex OAuth flow

Batch Implementation Order

Phase 5: Category 1 Quick Wins (1.5 hours)

  1. Asana (20 min)
  2. Airtable (20 min)
  3. Linear (20 min)
  4. ClickUp (20 min)
  5. Box (20 min)

**Target:** 20/39 integrations (51%)

Phase 6: Category 2 Google/Microsoft (1 hour)

  1. Gmail (15 min)
  2. Google Chat (15 min)
  3. Google Drive (15 min)
  4. Outlook (15 min)

**Target:** 24/39 integrations (62%)

Phase 7: Category 4 - Medium Complexity (2.5 hours)

  1. Trello (30 min)
  2. Shopify (30 min)
  3. Zendesk (30 min)
  4. Spotify (20 min)
  5. Canva (30 min)
  6. Calendly (30 min)

**Target:** 30/39 integrations (77%)

Phase 8: Category 4 - High Complexity (3 hours)

  1. Xero (45 min)
  2. QuickBooks (45 min)
  3. Plaid (60 min)
  4. Zoho Books (45 min)

**Target:** 34/39 integrations (87%)

Phase 9: Final Cleanup (1 hour)

  1. Mark API key integrations as N/A
  2. Update documentation
  3. Final testing
  4. 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

  1. **Start Phase 5** - Batch implement Category 1 quick wins
  2. **Use templates** - Copy patterns from Figma/Notion/Google Calendar
  3. **Test incrementally** - Commit after each integration
  4. **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