YouTube Data API v3 for 403 video upload prohibited: YouTubeSignUpRequired

I try to use the new YouTube v3 data API to upload videos to YouTube on Android, but I get a 403 forbidden error:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden 01-22 00:10:41.716: WARN/System.err(5209): { 01-22 00:10:41.716: WARN/System.err(5209): "code" : 403, 01-22 00:10:41.716: WARN/System.err(5209): "errors" : [ { 01-22 00:10:41.716: WARN/System.err(5209): "domain" : "youtube.header", 01-22 00:10:41.716: WARN/System.err(5209): "location" : "Authorization", 01-22 00:10:41.716: WARN/System.err(5209): "locationType" : "header", 01-22 00:10:41.716: WARN/System.err(5209): "message" : "Forbidden", 01-22 00:10:41.716: WARN/System.err(5209): "reason" : "youtubeSignupRequired" 01-22 00:10:41.716: WARN/System.err(5209): } ], 01-22 00:10:41.720: WARN/System.err(5209): "message" : "Forbidden" 01-22 00:10:41.720: WARN/System.err(5209): } 

The code is as follows:

I got the OAuth2.0 credentials and I used it to instantiate youtube:

  YouTube youTube = new YouTube.Builder(new NetHttpTransport(), new JacksonFactory(), credential) .setApplicationName("testapp/1.0") .build(); # ... creating video to save space ... youTube.videos().insert("snippet,statistics,status", video, mediaContent).execute(); 

Any idea?

thanks

+1
source share
3 answers

It looks like you're trying to upload a video to an unrelated Google account. This scenario is covered to some extent in this blog post , although the focus of this post is on the v2.1 API.

When it comes to version 3, you still cannot upload videos to an unrelated Google account, and there is no API call so that the user can programmatically link the account. It would be best to take the user http://m.youtube.com/create_channel , and they can take care of linking them to the browser, d you need to return to your application and try downloading again.

+1
source

You can use this mobile workflow in WebView so that the user can create a channel without leaving his application:

https://m.youtube.com/create_channel?chromeless=1&next=/channel_creation_done

To complete the processing, the user will // channel _creation_done after completion, and you can close the WebView. Here you can find additional information about the workflow: https://developers.google.com/youtube/create-channel

+1
source

I solved it, and my answer is here: How to embed youtube api v3 video through a service account with ruby Enjoy!

The error you get is that you did not add a person tag with an email address to download the movie. This is all resolved and works if you use the code in your answer

0
source

Source: https://habr.com/ru/post/1498163/


All Articles