private Account(string tokenFilePath, bool noReceiver) { if (!Settings.HasSecretsFile) { throw new InvalidOperationException(); } if (tokenFilePath == null) { throw new ArgumentNullException(nameof(tokenFilePath)); } TokenFilePath = tokenFilePath; // we want read & write access var scopes = new[] { DriveService.Scope.Drive }; UserCredential credential; using (var stream = File.OpenRead(Settings.SecretsFilePath)) { credential = GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, scopes, "user", CancellationToken.None, new FileStore(tokenFilePath)).Result; } Service = GetService(credential); RefreshAbout(); GetRootAndTempFolder(); UserFileName = GetUserFileName(UserEmailAddress); DataDirectoryPath = GetDataDirectoryPath(UserEmailAddress); // each GDrive account has its own synchronizer (cloud provider) instance IOUtilities.DirectoryCreate(DataDirectoryPath); OnDemandLocalFileSystem.EnsureRegistered(DataDirectoryPath, GetRegistration()); FileSystem = new FileSystem(this); // note the mpsync identifier must be *globally unique*, so you can choose a guid, or something like a .NET namespace Synchronizer = new MultiPointSynchronizer(typeof(Settings).Namespace, options: new MultiPointSynchronizerOptions { Logger = Settings.SynchronizerLogger, BackupState = true, StateProviderTraceLevel = Settings.Current.StateProviderLogLevel }); Synchronizer.AddEndPoint("Local", new OnDemandLocalFileSystem(DataDirectoryPath)); Synchronizer.AddEndPoint("GDrive", FileSystem); Log(TraceLevel.Info, "State file path: " + Synchronizer.StateProvider.ExecuteCommand(new Dictionary <string, object> { ["command"] = "filepath" })); }