title: youtube api token upload video
body: <p>I am retriving a token through an website, then I save the token, and refresh token in a database. Then I am writing .net program that uploads video's located on our server to youtube. My problem is to get the program I am making, use the stored token. I am using one of google's examples to upload the video. But the program should use the already saved token, instead os asking for new credentials. </p>
  
  <p>The current code is this.</p>
  
  <pre><code>UserCredential credential;
  
          //credential.UserCredential(,"",)
  
          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
              );
  
          }
          Console.WriteLine("HER");
  
          var youtubeService = new YouTubeService(new BaseClientService.Initializer()
          {
              HttpClientInitializer = credential,
              ApplicationName = Assembly.GetExecutingAssembly().GetName().Name
          });
  </code></pre>
  
  <p>So instead I would like to use an already saved token. </p>
  
  <p>Any help, or a pointer in the right direction would be great. Thanks. </p>