Is there any way of using the YouTube API so that users can upload videos directly to my business YouTube channel? Users would grant permission to upload to my channel on the website. I want to avoid uploading to another server, then to YouTube if possible. Thanks
20
votes
1 Answers
1
votes
You can use service account OAuth2 to authorize requests from your app on your behalf to a channel that your account is authorized to access/the owner of.
Create service account credentials: (documentation here) and make sure the YouTube Data API v3 is enabled on your API project (getting started guide here, if you're new to the API).
Use your service account OAuth credentials to call the upload API: (documentation here) use the auth in step 1 to upload the video your users share with you and specify your business YouTube channel ID in the video resource. Sample code in various languages here (just search for upload examples after you choose your preferred language).
Things to keep in mind:
- If you enable uploads to your channel by end users but don't do any checking/validation there is potential for abuse
- service account OAuth is valid for 1 year, so you'd need to refresh the service account credentials every year
- It will look like these videos are being uploaded by your business channel and not other user's channels (because that's what's happening via the API).