QUESTION
Which of the Youtube Data API auth methods will allow me to upload videos to a single channel without having to force my site’s user to authenticate?
- OAuth
- AuthSub
- Client Login
I’ve read http://code.google.com/apis/youtube/2.0/developers_guide_protocol.html#Authentication but am still unsure.
BACKGROUND
I’m building an application in Ruby on Rails which will require users to upload videos and associate them with an account within the application (not their youtube account).
I don’t need to associate the videos they upload with their youtube account, and it would be perfectly fine to have all the videos uploaded land in one youtube channel, similarly to how the Doritos Guru contest worked ( http://www.youtube.com/user/doritosguru )
So far as I can tell, I should only need to have access to a single youtube account, which I can create, and upload all the videos through this account. So far as youtube is concerned, this one user will own all the videos.
I’ve read through the different authentication options presented ( http://code.google.com/apis/youtube/2.0/developers_guide_protocol.html#Authentication ) but still am unsure which of these meets my needs.
Also, I’m looking for a ruby gem/rails plugin that will facilitate what I want to do.
I’m currently looking at http://github.com/edgarjs/youtube-model but don’t know if that will meet my needs.
Advice?
You should use the ClientLogin method.
For example, suppose you want to authenticate a YouTube account for which the username and password are testuser and testpassword, respectively. You can simulate the HTTP POST request using the Linux ‘curl’ command, as shown in the following example:
If your authentication request is successful, the response to your request will have the following format. (Please note that the token values have been shortened in the example.)
When you make an authenticated API request using a ClientLogin authentication token, your request needs to specify the Authorization HTTP request header as shown in the example below:
Then you can use the token in the rest of your application, and lump all the uploaded content into one youtube username.
As for gems, theres active-youtube, youtube_g and a few others, however I haven’t found any that really streamline the auth process. Most just allow you to query for top video feeds and stuff like that. A gem would make a good starting point though to build out the rest of your app. This completed upload script is a good starting point as well. Google’s Authentication Docs