Which Youtube Data API auth method should I be using? [closed] - ruby-on-rails

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
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:
curl \
--location https://www.google.com/accounts/ClientLogin \
--data 'Email=testuser&Passwd=testpw&service=youtube&source=Test' \
--header 'Content-Type:application/x-www-form-urlencoded'
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.)
SID=DQAAALQAAAA6wx7byZp-s4BizDqS1OaT21j9dmY6wMjexpQdNC3
LSID=DQAAALUAAAARH_PvRXoaz23Dv_UmOSUz2_0vh-4XbUedCN9XTZ
Auth=DQAAALUAAAARH_PvRXoaz23Dv_UmOSUz2_jxJVCGjoulKlhWbU
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:
Authorization: GoogleLogin auth=<authentication_token>
X-GData-Key: key=<developer_key>
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

Just a note, about allowing all videos to be uploaded to a single account. Not a technical point, but if you will indulge me...
If the account belongs to you and someone uploads a copyrighted material to it, its you that will take the wrap... If YouTube get complaints then your account can be suspended which means that all videos are unavailable, which means your entire app may not work!
What I did was ask the user for a YouTibe account when uploading videos, then, add the video to a playlist so it shows on the channel. You get the video and the responsibility and potential damage is restricted to a single account...

Related

How do I use the YouTube Data API to upload video to secondary channel on personal account

I have looked around Stack Overflow and seen a few posts about this but none of the solutions help.
I have a Google account which I use in YouTube. I have created a second channel on that YouTube account so that I can upload videos with a specific theme to separate them from the main videos.
Trying to use the Google API to upload the videos so that I can run it via a Python script, I keep hitting brick walls with Google who is looking for app verification, privacy policies and web page links - none of which I have.
This application is a Python script that's not available to the public and doesn't gather any public information. All I am trying to do is upload videos to my own personal YouTube account.
So I'm beginning to think it is something else I should be using rather than the API (the uploading web page isn't suitable for use in a script).
My two question are:
Can I use the YouTube API to upload a video directly to the second channel on my personal YouTube account?
Is there another simpler mechanism I should be using to upload videos via a script to my personal YouTube account? The reason I have to do it via script is that the device is unattended.
Thanks,
David
You have to acknowledge that each and every app (this to be understood in a broad sense that includes even a small script like this one from Google upload_video.py) must be verified and approved by Google prior to be able to make videos publicly available via the YouTube site.
Answer to question no. 1: yes, that is perfectly possible.
As part of the OAuth 2.0 authentication/authorization flow, you will be presented, within the browser, with the option of selecting to which account your app is to be given access rights.
You may well exercise this behavior, prior to making use of your script, with the help of Google Developers OAuth 2.0 Playground.
Upon a successful OAuth flow, you may verify (and also revoke) the permissions granted by your account on the account's permissions page.
Answer to question no. 2: no, there's no way to upload programmatically videos on YouTube that's in compliance with YouTube's DTOS, other than using the Videos.insert API endpoint.
Addendum
Since by now you have at least two credentials sets, it may be of need to know to which of your YouTube channels a given credentials object is associated.
If using the Google APIs Client Library for Python, you may easily obtain from the API the channel ID to which a given credentials object CREDENTIALS is associated by issuing a call to the Channels.list API endpoint, passing to it the parameter mine as mine=true:
from googleapiclient.discovery import build
youtube = build(
'youtube', 'v3',
credentials = CREDENTIALS)
response = youtube.channels().list(
mine = 'true',
part = 'id',
fields = 'items(id)',
maxResults = 1
).execute()
channel_id = response['items'][0]['id']
Note that the code above uses the fields request parameter for to obtain from the Channels.list endpoint only the channel's ID info (it is always good to ask from the API only the info that is of actual use).
A caveat using the above procedure is the following: if a given CREDENTIALS instance has its scopes containing only:
https://www.googleapis.com/auth/youtube.upload,
then the API will respond with an error of type insufficientPermissions and of message Request had insufficient authentication scopes.
For to invoke successfully the Channels.list it would be sufficient that the scopes attached to CREDENTIALS to include either of the one below:
https://www.googleapis.com/auth/youtube.readonly,
https://www.googleapis.com/auth/youtube.

YouTube API Compliance Audit [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
Today I received email from noreply#youtube.com with next text:
Dear YouTube API Developer,
We are currently conducting a mandatory compliance review of your YouTube Data API Project. The review is to assess your compliance to our YouTube API Services Developer Policies (link) and to learn about how our service is being used.
At your convenience in the next seven (7) business days, please complete and submit the following information:
A fully functional demo account, including a username and password with which we may access your API Client. The demo account you provide will be used only for compliance inspection and the credentials will not be shared.
A fully completed Youtube API Audit Form
Screenshots of how your API Client and its users access and use the YouTube API Services
Documents relating to your implementation, access and use of YouTube API Services
For reference, your project number is 0000000000
Please ensure that all required supporting materials are submitted and sufficient, and all questions are answered thoroughly. If this is not the correct or preferred API contact email, or if you would like us to cc any other contacts on future emails, please let us know.
Thanks,
YouTube API Services team
YouTube, LLC 901 Cherry Ave, San Bruno, CA 94066
Can someone explain to me - where should I send the answer?
This seems like an excessive requirement for a largely free API, but at any rate there is a link in the email to the submission form:
https://support.google.com/youtube/contact/yt_api_form

How to subscribe youtube channel in objective c? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have one custom UIButton. that button functionality is subscribing one default Youtube channel. is this possible to subscribe channel in my apps. please share some code or guide link.
You have to implement the YouTube API into your Objective-C application in order to do this.
Step 1
Since you want to enable the user to subscribe to a channel, you have to use OAuth 2.0 to allow the user to securely login to their YouTube account. The OAuth 2.0 is pretty simple to implement. Essentially it consists of the app opening up a Google login web page, getting the user to login/approve app access and then getting a callback string which contains a special code. You then use this code in a POST request to verify/obtain the user refresh/access tokens (a long string which represents a logged in user).
Step 2
Store the access token string securely in Keychain, don't user NSUserDefaults! Use the FDKeychain wrapper class to easily save/load the user access token to the OS keychain. You can access this wrapper class on Github: https://github.com/reidmain/FDKeychain
Step 3
Now you need to search through the Google (YouTube) developer API documentation, in order to find out how to subscribe to a channel. In fact I've found it: https://developers.google.com/youtube/v3/docs/subscriptions/insert
But basically it consists of you making a POST request to this API link: https://www.googleapis.com/youtube/v3/subscriptions
In the request you simply include the ID of the channel you wish to subscribe to and the access token of the user. Once the request has been made, you will receive a request response. Check the response for any error codes/etc.... If all went well, then the user has been successfully subscribed to the channel, otherwise parse the error code/description and alert the user.
Note
Access tokens don't last forever, they need to be refreshed from time to time. In order to refresh an access token, you need to make a POST request with your access token and refresh token to the Google API, learn more here: https://developers.google.com/identity/protocols/OAuth2WebServer#offline
The response of the above request, will return a new access token.

how to implement a user authentication system and create accounts for social network login? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am a newbie of user authentication, currently I am playing around with Azure AD B2C, it seems good but I want to create native pages in my app for user sign up and login instead of using the azure policy, so I want to implement this function in my app:
A user can sign up in to my app by filling his email and password, and then, a set of optional profile attributes. He also can login in to my app by using Facebook or Google, etc; and in the first time login, my app will ask the user to fill in the user profile and create an account for him in my app. So the user will eventually have an account for my app. I think this is very common in mobile apps, but I just don't know what is its structure and how it works, here is an example:
Adobe XD sign up or login page
The other question is how the server should verify a request sent by a user? Does it need to verify the Facebook access token, Google access token or my app access token embedded in the request separately? Or is there a way to safely verify the user identity in the same way?
I don't know how to put all the things together to make an app, please tell me how to implement it, or which services (like azure ad b2c) can satisfy my need, or please recommend some open source ios app projects which implement this function.
Thanks a lot, I've been thinking this problem for a couple of days :/
You should decide what solution would you like to use: your own solution or external, free or commercial. I can suggest you to take a look to https://auth0.com. They have manual for iOS: https://auth0.com/docs/quickstart/native/ios-swift/getting-started. Also you can find a lot of examples how to use auth0 in Internet.
Please be careful if you will use Facebook and Google APIs. Someday we had an error in our application because of gender field. Facebook API return MALE/FEMALE, but Google also have OTHER and this caused an error - on our side we had only MALE/FEMALE gender in our Enumeration and no OTHER type (gender validation failed because of this).

Storing YouTube metadata

I've read YouTube's Terms of Service several times and have Googled this question tirelessly with no concrete answer. This is not a legal question about my specific YouTube API client, I just want to know if any YouTube developer has used the API in this way. I'm working on a side project for myself that's essentially an Instagram-YouTube mashup. I am a YouTube developer with an API key. Can my API client store a videos title, description and id in my database when my users like a video on my client? I don't know how else I can keep track of my users liked videos within my client.
Since you already specified that this is in fact not a legal question, the short answer is: Yes, you can (meaning it is possible).
There is one more possibility coming to mind, though:
You could authenticate users via OAuth 2.0 using the https://www.googleapis.com/auth/youtube scope. That way, you can manage their liked videos and add/remove videos to this list when a user clicks the according buttons on your website (you can also check if any given video is already liked by the user). In this case, all the track-keeping is done by YouTube itself. This ultimately means that whenever a user likes a video in your app, they also like it on the YouTube website. This may or may not be desired, it is for you to decide that.

Resources