Add per-channel YouTube OAuth connection flow#9
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR implements a complete YouTube OAuth2 connection and analytics integration flow. It adds backend mutations and queries for managing channel analytics connections, API routes for OAuth callback handling, frontend pages supporting channel connection flows, and utility functions for Google OAuth token exchange and YouTube Analytics data retrieval. Changes
Sequence Diagram(s)sequenceDiagram
participant User as User / Browser
participant SignIn as Sign-In Page
participant OAuth as OAuth API Route
participant Google as Google OAuth Server
participant Callback as Callback Route
participant Convex as Convex Backend
participant YouTube as YouTube APIs
User->>SignIn: Submit sign-in with connectChannelId
SignIn->>SignIn: Authenticate & validate
SignIn->>OAuth: Redirect to /api/youtube/connect?channelId=...
OAuth->>Convex: Fetch channel connection target
OAuth->>OAuth: Build authorization URL with state (HMAC signed)
OAuth->>Google: Redirect to Google OAuth authorization
Google->>User: OAuth consent screen
User->>Google: Grant permissions
Google->>Callback: Redirect with authorization code
Callback->>Google: Exchange code for tokens
Google->>Callback: Return access/refresh tokens
Callback->>YouTube: Fetch user info & owned channel IDs
YouTube->>Callback: Return user data & channels
Callback->>YouTube: Fetch 30-day analytics snapshot
YouTube->>Callback: Return analytics metrics
Callback->>Convex: Call completeChannelAnalyticsConnection mutation
Convex->>Convex: Persist OAuth connection & analytics sync
Convex->>Callback: Return connectionId & synced flag
Callback->>User: Redirect to returnTo with success flag
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can generate a title for your PR based on the changes.Add |
Summary
Summary by CodeRabbit
New Features
Refactor