Example #1
0
 public IAuthorizationState GetAuthorization(Credentials credentials, string authCode)
 {
     var state = GetState();
       var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description, credentials.ClientID, credentials.ClientSecret);
       provider.ProcessUserAuthorization(authCode, state);
       return state;
 }
Example #2
0
        public void TestValuesCanBeInlaidCorrectly()
        {
            var credentials = new Credentials {ClientID = "123", ClientSecret = "456"};

              Assert.That(credentials.ClientID, Is.EqualTo("123"));
              Assert.That(credentials.ClientSecret, Is.EqualTo("456"));
        }
Example #3
0
 public DriveService GetService(Credentials credentials, RefreshToken refreshToken)
 {
     var provider = GetAppClient(credentials);
       var auth = new OAuth2Authenticator<NativeApplicationClient>(provider, GetAuthorization);
       var service = new DriveService(new BaseClientService.Initializer {Authenticator = auth});
       mRefreshToken = refreshToken;
       return service;
 }
Example #4
0
 public static NativeApplicationClient BuildNativeAppClient(Credentials credentials)
 {
     return new NativeApplicationClient(GoogleAuthenticationServer.Description, credentials.ClientID, credentials.ClientSecret);
 }
Example #5
0
 public FolderManager(Credentials credentials, RefreshToken refreshToken)
 {
     mService = new GetDriveService().GetService(credentials, refreshToken);
 }
Example #6
0
 public void TestDefaultsToNull()
 {
     var credentials = new Credentials();
       Assert.Null(credentials.ClientID);
       Assert.Null(credentials.ClientSecret);
 }
Example #7
0
 public GDriveFileManager(Credentials credentials, RefreshToken refreshToken)
 {
     mService = new GetDriveService().GetService(credentials, refreshToken);
       mFileEnum = new FileEnumerator(mService);
 }
Example #8
0
 public void Update(Credentials credentials)
 {
     mFile.WriteAllText(mPath, string.Format("{0}{1}{2}", credentials.ClientID, Environment.NewLine, credentials.ClientSecret));
 }
Example #9
0
 public string CreateRefreshToken(Credentials credentials, string code)
 {
     return new GetAuthorizationState().GetAuthorization(credentials, code).RefreshToken;
 }
Example #10
0
 public void UploadFileWithFolder(string file, string fileTitle, string[] foldersToUpload, Credentials credentials, RefreshToken refreshToken)
 {
     var uploader = new Uploader(credentials, refreshToken);
       uploader.UploadFileWithFolderSet(file, fileTitle, foldersToUpload);
 }
Example #11
0
 public string GetAuthUrl(Credentials credentials)
 {
     var result = GetAuthorizationUrl.GetAuthorization(GetAuthorizationUrl.BuildNativeAppClient(credentials));
       return result.ToString();
 }
Example #12
0
 public Uploader(Credentials credentials, RefreshToken refreshToken)
 {
     mService = new GetDriveService().GetService(credentials, refreshToken);
 }