public async Task <EnterpriseLoginMethods> ProbeLoginMethods(Uri enterpriseBaseUrl) { try { // It's important that we don't use our cached credentials on this connection, as they // may be wrong - we're trying to log in after all. var hostAddress = HostAddress.Create(enterpriseBaseUrl); var connection = new Octokit.Connection(program.ProductHeader, hostAddress.ApiUri); var meta = await GetMetadata(connection).ConfigureAwait(false); var result = EnterpriseLoginMethods.Token; if (meta.VerifiablePasswordAuthentication != false) { result |= EnterpriseLoginMethods.UsernameAndPassword; } if (meta.InstalledVersion != null) { var version = new Version(meta.InstalledVersion); if (version >= MinimumOAuthVersion) { result |= EnterpriseLoginMethods.OAuth; } } return(result); } catch { return(EnterpriseLoginMethods.Token | EnterpriseLoginMethods.UsernameAndPassword); } }