Vedchi
Vedchi

Reputation: 1210

Youtube : Multiple accounts authentication (OAuth) to upload video to single account/channel

I am integrating video upload to Youtube from iOS application.

Steps followed :

  1. Created Google account and enable Youtube data API for the account in developer console.
  2. Created client ID and client secret and incorporated in the application.
  3. Checked out Google API objective C client for Youtube upload which is normally a MAC tool, i just modified for iOS.
  4. Run the application.
  5. It will prompt for Login (OAuth).

Case # 1

GTMOAuth2ViewControllerTouch : completionHandler:^(GTMOAuth2ViewControllerTouch *viewController, GTMOAuth2Authentication *auth, NSError *error)
{

self.youTubeService.authorizer = auth;

}

Case #2

GTMOAuth2ViewControllerTouch : completionHandler:^(GTMOAuth2ViewControllerTouch *viewController, GTMOAuth2Authentication *auth, NSError *error)
{

self.youTubeService.authorizer = auth;

}

enter image description here

Note : If i uses same account (used to create client ID and secret) to login and upload, it is working fine and video is displaying in Youtube. But whenever trying with other account to upload it causing problem even in Google API objective C client application too.

let me know if i missing any other cases to be consider to do so. thanks.

Upvotes: 0

Views: 1004

Answers (2)

Vedchi
Vedchi

Reputation: 1210

After a day of search/testing, finally found the cause. There is nothing wrong with my OAuth process. The cause is other multiple accounts (not the one used to create Client ID and Client Secret) was not having a channel in Youtube.

Solution : If user account is new to Youtube, then youtube won't have a channel for that account. User need to create one (that's easy, Youtube itself will alert to create new channel when, My Channel from left side pane is get selected)

If user account have valid channel, then the above "Unauthorized" error won't be happen.

Upvotes: 0

Ibrahim Ulukaya
Ibrahim Ulukaya

Reputation: 12877

You may be doing Auth wrong, or the user may not have a valid connect YouTube channel. You can check YouTube Direct Lite for iOS project for the best example.

Upvotes: 0

Related Questions