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