I've got code based on Google's YouTube Data API (v3.0) videos.insert example, which fails consistently for a particular user and authorization token with a Failed to start the resumable upload
exception.
The code works well for other user/auth tokens.
I can use the auth token to list the users YouTube channel resources (showing that the token is valid), and compare with other users channels. The only difference that shows up is that the channel resources for the particular user doesn't show a googlePlusUserId
.
Any thoughts as to what I'm missing, or what to check next?
Turns out it's possible for a user to give YouTube account permissions without actually having a YouTube account ;-)
In Google_MediaFileUpload::getResumeUri
, if a valid response isn't received, a Failed to start the resumable upload
exception is thrown, and the response (containing the error reason) is thrown away.
In this case, dumping the response showed the reason: youtubeSignupRequired
.
(For my local code, I'm saving the response so the caller can report why the upload failed)
Update -- from YouTube Data API - Errors
This error indicates that the user has an unlinked Google Account, which means that the user has a Google Account but does not have a YouTube channel. Such users can access many features that are dependent on user authorization, such as rating videos or adding videos to a watch_later playlist. However, as an example, the user would need a YouTube channel to be able to upload a video. A user who has a Gmail account or an Android device is certain to have a Google Account but may not have already linked that Google Account to a YouTube channel.