Unable to OAuth with account that owns YouTube channel - oauth

I have a google account that I was previously uploading videos to using the v2 YouTube API. This account I guess has two accounts linked to it, because when I go through OAuth flows I have to choose which account.
The 1st account, the one I setup the API in developer console, gives me the option to authorize YouTube API controls.
The 2nd account, the one that actually is the YouTube channel, only says that I'm giving my application offline access, there is no permissions specified relating to YouTube.
I did my OAuth using the 1st account, since that one actually listed youtube permissions. Got my refresh token and added it to the application. However, when I go to attempt to insert a video to YouTube I get the following error:
Code 401 Unauthorized: youtubeSignupRequired
It's as though I'm not linking at all to the YouTube channel account even though they are both on the same Google account.
Has anyone encountered this before?
By the way, I know with certainty that my API calls work properly, as we were able to upload from the dev environment. The dev account is only a single account though that owns the channel on the same account as the API.

I was able to resolve this.
It turned out I needed to do the OAuth with the 2nd account, the one for the YouTube channel. Despite it not requesting any permissions related to YouTube and only getting offline access, I was able to successfully upload using the refresh token I received.
Definitely a case of the most illogical solution being the correct one.

Related

Permission denied on returning captions to YouTube

I have an integration with YouTube to return captions to videos of different YouTube accounts, and I use the YouTube API for this.
The thing is that some accounts are not being authorized to return captions. I made some investigation and I noticed some stuffs:
The oauth app seems to intermittently give an unverified warning to users trying to authorize the application to access their youtube account via api;
Even the users authorizing their accounts, when I try to return the captions I get an unauthorized message;
By digging more, I noticed that the access token had its expiration date to the moment of authorization.
The token is not being refreshed, which should be done by the refresh token, and seems to be not working.
Did someone had problems like that? How did you solved? I already tried to get in touch with YouTube support, but they could not give me a solution or a path to do a better investigation.
I was trying getting in touch with YouTube, but it seems that their technical support only replies on Stackoverflow.
Google saying that the app was not verified
Status of verified application

YouTube Data API: Choosing the destination YT channel when uploading my video

I've followed the steps explained here: https://developers.google.com/youtube/v3/guides/uploading_a_video in order to use their script to upload a video on my channel.
The problem is that my GMail account is associated to two YouTube channels: my personal one which is its default YT channel, and a new one that I've created this morning. The latter is the good destination channel for my videos.
How can I tell the YouTube Data API to upload the video to this channel and not the default one? I didn't see anything useful in the Console API "YouTube Data API", nore in the technical documentation of the upload script (given above).
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.

YouTube video insert fails with 401 Unauthorized youtubeSignupRequired

I'm uploading videos to many customers using Google API v3 with PHP client lib, it works for most of them so I guess the issue is not in my code.
For the customers that fail, it always fails, so I believe the problem is with their authentication, however, for these customers I do get categories list with no problem, it's just the video upload that failed.
That made me think it's because of the scopes I used during the authentication, but I used the same scopes for all my customers, those that work and those that don't.
Any idea?
Thanks,
Tan-Tan
A couple of years ago, YouTube accounts changed and became integrated with Google+. After that point, all new accounts were actually Google+ accounts with a linked YouTube channel; however, YouTube accounts that were created before that changeover needed to manually log in and link their YouTube account to their Google+ account. When you try to use the YouTube API to upload a video, if they have one of these legacy accounts that they haven't manually linked, you'll get the error message that you're experiencing.
There's no API call to do the linking for them; so if your app gets that message, you'll have to redirect them to http://m.youtube.com/create_channel and have them link their accounts.

YouTube OAuth: Why do some accounts give me "Invalid Credentials"?

I'm using OmniAuth in Rails to authenticate users through YouTube OAuth.
I have several Google/YouTube accounts. Two of them log in just fine. Two of them fail with "invalid_credentials".
I'm not entirely sure what that error means; it doesn't appear in the OAuth 2 spec.
I'm successfully logged into all four of these accounts on the Google side using multiple sign-in, so it's not that I'm logging in incorrectly. Two of the accounts work, so it's not that my API key is bad.
What's going on?
I've got the answer.
They're returning invalid_credentials because there's no YouTube account associated with the user who's trying to log in.
But! I did make sure to log into YouTube with those accounts before trying to log into my app. Turns out that's not enough.
In this brave new world, Google users can log into YouTube without actually creating a YouTube account. In the YouTube UI, a YouTube account is a "channel". It is now possible to log into YouTube and not have a channel.
To create a channel, click the user menu (represented by your profile picture) in the top-right corner of the page and click "My Channel". You'll be prompted to create one.
Then you can log in with YouTube OAuth.

Youtube API: nolinkedyoutubeaccount error returned from api after disconnecting it from google plus identity

Rephrasing of the question:
Using the youtube api v 3.0 with oauth, when the user is sent to login, they have more than one option: e.g. the linked youtube account and the google account. The two different logins (access tokens) have different access to the api. I need the ability to just sent the user to log in to their proper youtube account (if they have one). How can my app do this? The user currently will have no idea which option they are supposed to choose, even if the app might be able to tell which they have chosen afterwards.
https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=1056190619576.apps.googleusercontent.com&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=https:%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube
original phrasing of the question:
OK, this is getting really really confusing. My youtube account uses a gmail, so I think that it is safe to say that it is linked to my google account (if such a thing linkage does exist). A couple of days ago I was on youtube, and the web site roped me into giving my youtube account its own google+ account (as far as I could tell). My gmail/google account does not have google+. Anyway, shortly thereafter I undid the linking of a google+ account to the channel. Ominously, at this point youtube indicated that this was only temporary.
And the net effect of this is: I can't use the youtube api with the youtube account. It says nolinkedyoutubeaccount .
So, the youtube api seems unusuable to me. This confusion is enough to make a person's head spin. But can anyone suggest a solution to get my account working with the api again?
Edit: I have managed to reproduce the error (more or less) with a newly opened youtube account. More here: https://code.google.com/p/gdata-issues/issues/detail?id=4860
These blog posts should help explain what's going on
http://apiblog.youtube.com/2013/06/google-page-identities-and-youtube-api.html
http://youtubecreator.blogspot.com/2013/04/using-google-page-identity-on-youtube.html
Based on what you describe, I think things are working as intended, but you do need to be careful to ensure that you select the correct channel when going through the OAuth 2 flow.

Resources