private async void button1_Click(object sender, EventArgs ea) { try { try { var service = new HpeFortifyService(_clientId, _clientSecret); var authResponse = service.Login(); var release = await service.GetLatestRelease(); var vulnerabilities = await service.GetCurrentVulnerabilities(release.ReleaseId.Value, null); dataGridView1.DataSource = vulnerabilities; } catch (Exception e) { Debug.Print("Exception when calling ApplicationMonitoringApi.ApplicationMonitoringV3GetApplicationMonitoringConfiguration: " + e.Message); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); MessageBox.Show(ex.Message); } }
private async Task <string> GetAuthToken() { if (!HasValidAuthToken) { var service = new HpeFortifyService(_clientId, _clientSecret); _authResponse = await service.Login(); _authExpiration = DateTime.Now.AddSeconds(Int32.Parse(_authResponse.expires_in)); } return(_authResponse.access_token); }