Exemple #1
0
        public Drive(IUserCredentialApplication ucApp)
        {
            credential = DriveCredentialsService.GetUserCredential(ucApp);
            service    = DriveCredentialsService.GetService(ucApp);

            application = ucApp;
        }
Exemple #2
0
        public static UserCredential GetUserCredential(IUserCredentialApplication ucApp)
        {
            GoogleWebAuthorizationBroker.Folder = "Drive.Sample";
            UserCredential credential;

            using (var stream = ucApp.ClientJson)
            {
                var secrets = GoogleClientSecrets.Load(stream).Secrets;
                credential = GoogleWebAuthorizationBroker.AuthorizeAsync(secrets, new[] { DriveService.Scope.DriveFile, DriveService.Scope.Drive }, "user", CancellationToken.None).Result;
            }

            return(credential);
        }
Exemple #3
0
 public static DriveService GetService(IUserCredentialApplication ucApp)
 {
     return(GetService(GetUserCredential(ucApp), ucApp));
 }