I want to upload videos to my YouTube channel programmatically, but when I try to upload using API Key, I got the error in response, that this API don't support API Key.
When I try using OAuth, my program always open browser and open Google page with grants confirmation, but I want to upload videos without any confirmations.
Also I tried use Service Account, but in the documentation wrote that API don't support service accounts.
How I can upload videos without any confirmations (for example, using credentials)?
EDITED
I setting API Key using the next code:
var videosInsertRequest = youtubeService.Videos.Insert(video, "snippet,status", fileStream, "video/*");videosInsertRequest.Key = "MY_KEY";And also I tried using OAuth2 login using the next code:
UserCredential credential;using (var stream = new FileStream("client_secrets.json", FileMode.Open, FileAccess.Read)){ credential = await GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets, // This OAuth 2.0 access scope allows an application to upload files to the // authenticated user's YouTube channel, but doesn't allow other types of access. new[] { YouTubeService.Scope.YoutubeUpload },"user", CancellationToken.None );}var youtubeService = new YouTubeService(new BaseClientService.Initializer(){ HttpClientInitializer = credential, ApplicationName = Assembly.GetExecutingAssembly().GetName().Name});