1

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

1
  • Is the user going through the 3-legged OAuth flow? That is, are they presented with a screen asking if your application can have access to their account?
    – Ikai Lan
    Jan 23, 2013 at 9:07

4 Answers 4

1

It sounds like you're trying to upload a video into an unlinked Google account. That scenario is covered in this blog post to some extent, though the focus of that post is v2.1 of the API.

When it comes to v3, you still can't upload a video into an unlinked Google account, and there's no API call to allow a user to programmatically link an account. Your best bet would be to take the user to http://m.youtube.com/create_channel and they can take care of the linking there from a browser, at which point they'd have to return to your app and attempt the upload again.

1

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

0

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

The error you are getting is because you didn't add the person tag with the email to upload the movie to. It is all solved and working if you use the code in my answer

0

No YouTube channel is associated with your Google Account. Go to YouTube and click "Create a channel".

Create a channel - YouTube

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.