I’m working on a web application where users sign in using OAuth 2.0 Client ID. After they log in, I want to fetch information from YouTube Data API v3. The problem is I don’t want to use my developer API key because it will hit the quota limits too fast with multiple users.
Is there a way to make API calls using each user’s own API key instead of mine? I’m wondering if this approach is technically feasible and how other developers handle quota management in similar situations.
Any guidance would be really helpful!
You’re approaching this from the wrong angle. Users don’t have their own API keys for YouTube Data API - that’s not how the system works. What you actually need is to use the OAuth 2.0 access tokens you’re already getting when users sign in. When a user authenticates through OAuth, you receive an access token that represents their authorization to use YouTube on their behalf. Use this token in your API requests instead of your developer key. The quota consumption will still count against your project, but this is the intended behavior. For quota management, consider implementing request caching, rate limiting per user, or applying for quota increases if your application grows. Some developers also optimize by batching requests or using more efficient endpoints. The key insight is that OAuth tokens are meant for accessing user data, while API keys are for public data access.