/// <summary> /// Log out of the companion API and remove local credentials /// </summary> public void Logout() { // Remove everything other than the local email address Credentials = CompanionAppCredentials.FromFile(); Credentials.machineToken = null; Credentials.machineId = null; Credentials.appId = null; Credentials.password = null; Credentials.ToFile(); CurrentState = State.NEEDS_LOGIN; }
// Obtain a response, ensuring that we obtain the response's cookies private HttpWebResponse GetResponse(HttpWebRequest request) { Logging.Debug("Entered"); Logging.Debug("Requesting " + request.RequestUri); HttpWebResponse response; try { response = (HttpWebResponse)request.GetResponse(); } catch (WebException wex) { Logging.Warn("Failed to obtain response, error code " + wex.Status); return(null); } Logging.Debug("Response is " + JsonConvert.SerializeObject(response)); UpdateCredentials(response); Credentials.ToFile(); Logging.Debug("Leaving"); return(response); }