Fetches YouTube channel membership count/list and subscriber count/list via the YouTube Data API v3.
CLIENT_ID, CLIENT_SECRET, and API_KEY in your Vercel environment variablesREDIRECT /api/auth
Starts OAuth2 flow. Requests both youtube.channel-memberships.creator and youtube.readonly scopes.
GET /api/callback
OAuth2 callback. Displays the refresh token and granted scopes.
Returns channel membership list and total count. Requires the youtube.channel-memberships.creator scope.
{
"totalMembers": 42,
"fetchedCount": 42,
"members": [...],
"lastUpdated": "..."
}
GET /api/subscribers?key=YOUR_KEY
Returns subscriber count, video count, view count, and recent subscribers list.
{
"channel": { "id": "...", "title": "..." },
"subscriberCount": 1234,
"videoCount": 50,
"viewCount": 100000,
"recentSubscribers": [...],
"lastUpdated": "..."
}
Checks token validity and granted scopes. Use this to diagnose 403 errors.
If /api/members returns 403, the most common causes are:
youtube.channel-memberships.creator scope is restricted. In Google Cloud Console, your app must pass OAuth verification for this scope to work beyond test users./api/debug to check which scopes were actually granted.