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; }
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")); }
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; }
public static NativeApplicationClient BuildNativeAppClient(Credentials credentials) { return new NativeApplicationClient(GoogleAuthenticationServer.Description, credentials.ClientID, credentials.ClientSecret); }
public FolderManager(Credentials credentials, RefreshToken refreshToken) { mService = new GetDriveService().GetService(credentials, refreshToken); }
public void TestDefaultsToNull() { var credentials = new Credentials(); Assert.Null(credentials.ClientID); Assert.Null(credentials.ClientSecret); }
public GDriveFileManager(Credentials credentials, RefreshToken refreshToken) { mService = new GetDriveService().GetService(credentials, refreshToken); mFileEnum = new FileEnumerator(mService); }
public void Update(Credentials credentials) { mFile.WriteAllText(mPath, string.Format("{0}{1}{2}", credentials.ClientID, Environment.NewLine, credentials.ClientSecret)); }
public string CreateRefreshToken(Credentials credentials, string code) { return new GetAuthorizationState().GetAuthorization(credentials, code).RefreshToken; }
public void UploadFileWithFolder(string file, string fileTitle, string[] foldersToUpload, Credentials credentials, RefreshToken refreshToken) { var uploader = new Uploader(credentials, refreshToken); uploader.UploadFileWithFolderSet(file, fileTitle, foldersToUpload); }
public string GetAuthUrl(Credentials credentials) { var result = GetAuthorizationUrl.GetAuthorization(GetAuthorizationUrl.BuildNativeAppClient(credentials)); return result.ToString(); }
public Uploader(Credentials credentials, RefreshToken refreshToken) { mService = new GetDriveService().GetService(credentials, refreshToken); }