Я использую следующий код для загрузки видео на YouTube. Он работает с одним из моих учетных записей YouTube, но с другим он не работает. Я просто заменяю идентификатор клиента и секретность клиента, чтобы переключаться между аккаунтами YouTube. Любые идеи о том, почему он не работает с моей другой учетной записью YouTube?Google API OAuth 2 Code - Загрузка YouTube
var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description)
{
ClientIdentifier = ClientId,
ClientSecret = ClientSecret
};
var auth = new OAuth2Authenticator<NativeApplicationClient>(provider, GetAuthorization);
var youtube = new YouTubeService(new BaseClientService.Initializer()
{
Authenticator = auth
});
var video = new Video();
video.Snippet = new VideoSnippet();
video.Snippet.Title = "Demo 1";
video.Snippet.Description = "Demo 1a";
video.Snippet.Tags = new string[] { "tag1", "tag2" };
video.Snippet.CategoryId = "22";
video.Status = new VideoStatus();
video.Status.PrivacyStatus = "private";
var filePath = @"C:\wildlife.wmv";
var fileStream = new FileStream(filePath, FileMode.Open);
var videosInsertRequest = youtube.Videos.Insert(video, "snippet,status", fileStream, "video/*");
videosInsertRequest.ProgressChanged += videosInsertRequest_ProgressChanged;
videosInsertRequest.ResponseReceived += videosInsertRequest_ResponseReceived;
var uploadThread = new Thread(() => videosInsertRequest.Upload());
uploadThread.Start();
uploadThread.Join();
Вы включили обслуживание youtube в другом? – Naren
да я. Я проверил. –