I have a web application running on web server IIS, so to initialize service we need GoogleAuthorizationCodeFlow instead of GoogleWebAuthorizationBroker.
What should be passed in HttpClientInitializer
when creating a service object?
var flow = new GoogleAuthorizationCodeFlow(new GoogleAuthorizationCodeFlow.Initializer
{
ClientSecrets = new ClientSecrets
{
ClientId = _clientId,
ClientSecret = _clientSecret
},
Scopes = UserAccountCreds.SCOPES,
DataStore = new FileDataStore(@"C:\GoogleDriveViewer\DataStore", true)
});
UserCredential credentials = new UserCredential(flow, "user", token); // HOW DO YOU GET REFRESH TOKEN
DriveService service = new DriveService(new BaseClientService.Initializer()
{
HttpClientInitializer = , // HELP NEEDED HERE
ApplicationName = "Drive API Sample",
});