How to use Google Api to upload to a single Youtube channel on a User-less app - swift

I'm building an app that will allow users to upload videos to my Youtube channel. I have checked online about using Google Api to access the data/upload videos, but all references and examples seem to assume videos will be uploaded to the user's youtube channel, hence the process always involves using OAuth to gain approval from the user.
However, in my case the only youtube channel all users will access is mine. And I'm not even asking them to create an account on my app to upload the videos. Is there a way to do this directly from the app.
My app is an iOS app, but if you have a solution in any other language, I welcome your suggestion.
Thanks in advance

I had the same problem not so long ago. Youtube Documentation doesnt make it easy. Even though you getting access to your own Youtube channel, You still need to be authenticated using OAuth. Google makes hard for you to be vulnerable to attacks.
My solution is using a server side(API) application. What you can then do is make your iOS app hit the API.
So the tricky thing is getting the refresh token. Its hardly documented anywhere. What you can then do is follow documentation of your preferred language for the API.
The documentation can be found here https://developers.google.com/youtube/v3/guides/auth/server-side-web-apps
Get the Refresh token:
Step 1 : Hit this url in the browser https://accounts.google.com/o/oauth2/auth?client_id=ClientID_Here&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=https://gdata.youtube.com&response_type=code&access_type=offline
It will make you log in using your youtube credential which is your google account.
You will then have to agree for google to access your account by clicking allow.
At the end it will give you a code.
Step 2 : You should then authenticate using a clientless platform.
(eg instead of browser) Use curl instead. (There plenty of 3 minute tutorials on how to use curl)
Hit this url endpoint :
curl https://accounts.google.com/o/oauth2/token -d "code=CodeFromGoogleOAuth&client_id=ClientIDHere&client_secret=ClientSecretHere&redirect_uri=urn:ietf:wg:oauth:2.0:oob&grant_type=authorization_code"
You should then get a refresh token in the response.
There are alot of examples of how to upload from then on like
https://developers.google.com/youtube/v3/code_samples/dotnet
In the example above you have to avoid using the GoogleWebAuthorizationBroker use Googles one instead. Look for RefreshToken Field

It is not possible to allow third parties to upload videos to a single YouTube account with the YouTube Data API, and that is by design. See this Google Blog, explaining "It’s tempting to design a system in which all videos are uploaded to a single “master” YouTube account, but this is always the wrong approach."
A potential workaround is to use YouTube Direct Lite, which allows you to easily build and moderate a playlist on your YouTube account comprised of videos uploaded by your users on their accounts.

Related

Publishing videos on TikTok using TikTok API?

This has been a big mystery to me so I'm gonna ask here in a hope that someone can help me with it.
So, I'm trying to use the TikTok API to Auto Publish videos onto TikTok's account.
I cannot find any information about this on their API docs.
So I did a research and found out that other companies like 'Later' or 'HootSuit' have this Auto Publishing feature for TikTok.
So I signed up on Later to test how they do it. I found out that there are these Scopes/Permissions being used:
user.info.basic,
user.insights,
video.list,
video.insights,
comment.list,
comment.list.manage,
video.publish
and I found those from the URL when I allowed the Later TikTok App to be added to my TikTok account:
https://www.tiktok.com/auth/authorize?client_id=7051484449883553794&client_key=7051484449883553794&redirect_uri=https%3A%2F%2Fapp.later.com%2Fusers%2Fauth%2Ftiktok_business%2Fcallback%3Fstate%3De0af91a683a02ec0636ee1b42e6e9caf60ccc8295252260b&response_type=code&scope=user.info.basic%2Cuser.insights%2Cvideo.list%2Cvideo.insights%2Ccomment.list%2Ccomment.list.manage%2Cvideo.publish&state=e0af91a683a02ec0636ee1b42e6e9caf60ccc8295252260b
My TikTok app (this is the API app), asks for these permissions:
user.info.basic,
video.upload,
Now, I know that is the fist and most probably the main issue here BUT I don't have any option to add those Scopes to my App!
The only scopes that TikTok API mentions and talks about are these:
user.info.basic
video.list
video.upload
which you can see here:
https://developers.tiktok.com/doc/tiktok-api-scopes/
My app now only uploads the video on the users account and the users get a push notification on their app asking them to login to their account and edit/pulish the video!
So there is no auto publishing.
Just to clarify, the user's account is a business account as well as this is a requirement for the TikTok auto publishing to work.
The question is, where and how I can add those scopes/permissions to my App?
are there any other steps that I need to take?
Since you are using a Tiktok Business account, may you should rather use the Marketing APi (https://ads.tiktok.com/marketing_api/docs?id=1753986142651394)
This has video publish scopes too and is a lot different from the Tiktok API you get from Tiktok for developers.
Note:
Tiktok for developers API is geared towards general use, while the Marketing API is for Businesses, hence more features.
Caution
JFYI, If you have a business account, you cannot monetize the content. I am facing the same issue, but i cant move to business account(and Marketing API) for that reason.

facebook, twitter, youtube app creation and api integration help required... just a small answer required

I am working on PHP application which will be shipped to many users for their own.
App needs to integrate
Facebook api for auto post their web articles to their fb profile/page.
Twitter api for same purpose as above and to search for tweets/users.
Youtube api to upload videos to their user account.
I already have completed the software, Right now software has api settings menu for each of them. Where user create their own app on respective platform and setup app id/secrets etc... IT works fine...
But I am looking for a way where, we use our own app codes, and user only has to click on button which redirect them to their platform and they can allow access to our app. So they dont have to go through their own app creation.
Just like how login with social media things work...
I know thats possible and my question is not about how to do this...
My question is about IF I do that, will that create any App usage limitation issues for users ? For example, if I create my own Youtube app settings from http://console.developers.google.com/ and all users just authorise my app to their account, will it create any issues if all users (may be 2000 users) uploads upto 5 videos per day ? Will the usage limit counted per application or per user access assigned ?
I need the answer for facebook/twitter and youtube. I know some one how has already done this can answer this quickly and easily...
Thanks for reading my question...

Can track belong to the application and not individual users?

My application isn't going to be revolved around soundcloud users, I will be using it for its nice api that is provided to stream audio. I also want to use the javascript upload feature but that seems to be out of the question too.
The record widget should be able to upload the audio to your server so that you can upload the audio not as an individual user.
I still haven't been able to get my app to work without using their authentication window.
Any help would be appreciated.
Nearly everything you do with the SoundCloud API must be done on behalf of a SoundCloud account. You can only use the SoundCloud API to stream content from or upload content to a SoundCloud account.
If you'd like to have SoundCloud functionality in your app, I'd recommend allowing users to connect their SoundCloud accounts.
"Authenticating without the SoundCloud Connect Screen", from the API docs: http://developers.soundcloud.com/docs/api/guide#user-credentials
With this method you can log in as a user in the code. Since every app must be registered to a user anyway, you can make a new username to register the app, and log in with that one.

How to setup Facebook Timeline Cover Photo auto upload in website?

I am new to Facebook API and app development. I am trying to build a facebook timeline cover website where users can auto upload and publish the cover to a new album created in the website/app name. Then they would be redirected to another page on my website with instructions on how to setup the cover on their profile timeline. Most profile cover websites are using the same method such as myfbcovers.com, facebookprofilecovers.com, profilephotocovers.com, facebook.coversdaddy.com, fbcoverlover.com and newfbcovers.com to name a few. I have been searching the facebook developer pages and several tutorials over the net. Some tutorials I checked are:
http://thinkdiff.net/facebook/graph-api-iframe-base-facebook-application-development/
http://daipratt.co.uk/facebook-api-upload-photo/
http://developers.facebook.com/blog/post/498/
And also several youtube videos.
But there are several confusions I have about the app. Sorry for the questions if they are too basic as I am a complete newbie who is willing to learn. One of the main problems is that most of the tutorials are outdated as the facebook app creation page etc. Now is different and there is no callback url etc. or canvas etc. in options now which are used in the tutorials. In the tutorials, it is mentioned that for creating a website app or facebook app for page, I need a callback URL which I cannot see now. Secondly, if it is mentioned in those tutorials that I need SSL in my website for an app but none of the facebook cover websites listed above have SSL it seems. I also do not have SSL on my server. So, not sure if that is needed and if an app is needed at all on my local server. And all the apps are doing things different such as I can see these URLs on clicking on some of the clickable links for uploading the cover button. Here are a few examples:
http://facebookprofilecovers.com/wp-content/themes/fbcovers/fb/?i=http%3A%2F%2Ffacebookprofilecovers.com%2Fwp-content%2Fuploads%2FHappily-Married-Facebook-Timeline-Cover.png
http://freetimelinecovers.net/facebook/?cov_img=/images/sports-covers/manchester-united.jpg
Some have direct link to the facebook app page such as:
http://apps.facebook.com/profilephotocovers/index.php?id=35 broken link
And only one website seems to have the publish_stream etc. in the url itself
https://facebook.com/dialog/oauth?client_id=162046520556852&redirect_uri=http%3A%2F%2Ffacebook.coversdaddy.com%2Fi-m-not-a-monster-1242.html&state=e4abcdc1d9288be8233a7ac4aa243997&scope=user_photos%2Cpublish_stream
On checking through Live HTTP header, it seems all websites are following a similar pattern which is directly used in the URL in the last website. For example, here are a few steps of the other websites I saw while checking with Live HTTP header.
https://graph.facebook.com/oauth/authorize?client_id=112308188876405&redirect_uri=http://www.myfbcovers.com/oauth/callback&scope=publish_stream,user_photos,email
https://facebook.com/dialog/oauth?client_id=237897089598589&redirect_uri=http%3A%2F%2Ffacebookprofilecovers.com%2Fwp-content%2Fthemes%2Ffbcovers%2Ffb%2Findex.php&state=0ca1581f006bdd80bd5da78e95179f3a&scope=publish_stream
And so on.
I could also notice that almost all websites were taking auth for only publish_stream and nothing else. Only myfbcovers.com is an exception which also asks for user_photos and email. Rest are not asking for the same and so perhaps publish_stream is the only permission needed.
So, to create the app is there any tutorial. And do I need to host the app on my own server in a sub directory of the website or does it make direct call to facebook. The reason I am asking is because it seems Facebook apps if hosted on local server needs SSL mandatory whereas none of the above websites have SSL/https. And if I do not need to host the app on my own server then how can I make the photo upload link to facebook and then return back to the website for the rest of the instructions. I am using Wordpress on my website like most of the other sites are doing and so, that should not be a problem I suppose. Any help would be highly appreciated. I am willing to learn properly and some good tutorials for creating the photo album and then uploading the photo to the user's album etc. would be fine too if not with the full code. Any help would be highly appreciated.
NOTE: I have removed the HTTP and WWW part in many of the above URLs as I can only post a maximum of two links being a new user. Please add them if needed in those where they are not present.
Ok, I did not install all the applications above to see exactly what they did. I think your question is long... but pretty straight forward. This is what I understand your question to be :
You would like to create a cover photo generator that will allow users to customize their cover photo by uploading files, maybe doing some editing to them. Also maybe using templates of cool ideas and in the end being able to update their cool new cover photo directly into their profile.
This is not very complicated to do although to this date there is no real documentation (by facebook) about how to dynamically update the cover photo. However there are ways of creating photo albums and uploading photos to there.
If you are planning to make your application run with in facebook - that means use the apps.facebook.com/your_app_name, and have canvas or tab URLS, then you will have to purchase an SSL certificate.
Finnaly, in order to get as close to the functionality your want, you might have to make some sacrifices (becuase changing the cover photo is not possible yet with the Graph API).
To locate the cover photo album you'll have to manually scan through all the users albums names - and for that you'll need the user_photos permission.
Once you have created the photo you want, you could possibly let the user upload it (publish_stream permission needed for this) to a different album, and then give the user some detailed instructions using screen shots and direct them exactly how to change their cover photo.
I recommend you read through the Authentication documentation decide what permissions you need (such as user_photos for the users photos and publish_stream for uploading a new picture or creating an album.)
In addition, there are many many tutorials on the Official Facebook Documentation Pages and their Developers Blog- check them out before going onto other sites that have written their own tutorials. Facebook does update their API quite a bit - but they also (recently) have been pretty good on updating their documentation to mirror the changes to the API...
As serious developers using a 3rd party API (
Graph API ), it is solely our responsibility to keep up to date with changes and to write code and applications that comply with their platform policies.

Post video to wall from IOS, through server

I've done a fair bit of searching for this, but can't seem to find an answer for this specific problem. I'm fairly new to web development as well, so forgive me if the answer is right in front of my eyes.
I have an IOS app which needs to allow a user to post a video to his FB wall, which is created from content the user creates from within the app.
However, the rendering of the video is too processor-instensive for the device itself, so I'm hoping to do something like the following:
Allow the user to authenticate the post, using the IOS login.
When this happens, ipload an xml file to a remote server which has all the data needed to render the video.
This server is running a custom app which will render the video and then complete the post operation, uploading the video with the user's credentials and posting it to their wall.
Is this possible? If not, can anyone suggest alternatives? Maybe I could host the file somewhere else and then simply post a link to it on the wall directly from the app?
Thanks in advance.
Sounds like this tutorial is what you want:
How-To: Use the Graph API to Upload a Video (iOS)
You'll obviously have to tweak it since you're doing the upload server side, but should be able to figure that out. The basics you'll needto do:
have the iOS app log the user in and grant the correct permissions
after login, keep track of the user's facebook access token
When submitting the video-generation request to your server, include the user's access token
When the server is ready to post, it uses that access token to post on the user's behalf.