title: Using the YouTube v3 Data API for .NET, how is it possible to get a refresh token?
body: <p>I need to be able to use a refresh token to be able to re-authenticate a token after the access token has expired. How can I do this using the C# v3 API? I've looked at the UserCredential class and AuthorizationCodeFlow class and nothing is jumping out at me.</p>
  
  <p>I'm using the following code to authenticate it originally.</p>
  
  <pre><code>var result = await new AuthorizationCodeMvcApp(this, new AppFlowMetadata()).
              AuthorizeAsync(CancellationToken.None);
  if (result.Credential != null)
  {
      var service = new YouTubeService(new BaseClientService.Initializer
                  {
                      HttpClientInitializer = result.Credential,
                      ApplicationName = "YouTube Upload Tool"
                  });
  }
  </code></pre>
  
  <p>And this is my <strong>AppFlowMetadata</strong> class.</p>
  
  <pre><code>public class AppFlowMetadata : FlowMetadata
  {
      private static readonly IAuthorizationCodeFlow flow =
          new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer
          {
  
              ClientSecrets = new ClientSecrets
              {
                  ClientId = "ID",
                  ClientSecret = "SECRET",
              },
              Scopes = new[] { YouTubeService.Scope.YoutubeUpload },
              DataStore = new EFDataStore(-1) // A data store I implemented using Entity Framework 6.
          });
  
      public override string GetUserId(Controller controller)
      {
          return "test";
  
      }
  
      public override IAuthorizationCodeFlow Flow
      {
          get { return flow; }
      }
  }
  </code></pre>
  
  <p>If anyone can suggest anything, I would greatly appreciate it. Thank you.</p>