private static async Task <int> DownsyncWithAuthentication(Config config, GoogleOAuthFlow.ApplicationOAuthConfiguration applicationOAuthConfiguration, string folder, string package) { if (((string)config.BlockStorageURI).StartsWith("gs://")) { await GoogleOAuthFlow.RefreshUserApplicationDefaultCredentials(applicationOAuthConfiguration); if (!await Longtail.DownsyncFromGSBucket(applicationOAuthConfiguration.ApplicationDefaultCredentialsFile, config.BlockStorageURI, folder, PackageNameToURI(config.VersionIndexStorageURI, package))) { Console.WriteLine("Untar operation failed."); return(1); } } else { if (!await Longtail.DownsyncFromLocalStore(config.BlockStorageURI, folder, PackageNameToURI(config.VersionIndexStorageURI, package))) { Console.WriteLine("Untar operation failed."); return(1); } } return(0); }
private static async Task CreateUserAuth() { Initialize(out _, out GoogleOAuthFlow.ApplicationOAuthConfiguration applicationOAuthConfiguration); await GoogleOAuthFlow.CreateUserApplicationDefaultCredentials(applicationOAuthConfiguration); }
private static void ClearAuth() { GoogleOAuthFlow.RemoveApplicationDefaultCredentials(ApplicationDefaultCredentialsFile); }