YouTube Data API v3 视频上传 403 被禁止:YouTubeSignUpRequired [英] YouTube Data API v3 video upload 403 forbidden: YouTubeSignUpRequired
本文介绍了YouTube Data API v3 视频上传 403 被禁止:YouTubeSignUpRequired的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I am trying to use the new YouTube Data API v3 to upload video to youtube on Android, but I am getting 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 follow:
I got the OAuth2.0 credential, and I used it to create an instance of 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
解决方案
You can use this mobile workflow in a WebView to have the user create the channel without leaving your app:
https://m.youtube.com/create_channel?chromeless=1&next=/channel_creation_done
To process will take the user to /channel_creation_done once completed, and you can close the WebView then. You can find more information about the workflow here: https://developers.google.com/youtube/create-channel
这篇关于YouTube Data API v3 视频上传 403 被禁止:YouTubeSignUpRequired的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文