public string Login(string email, string password, out ApiError error) { using (var client = new HttpClient()) { var values = new Dictionary <string, string> { { "email", email }, { "password", password }, }; var content = new FormUrlEncodedContent(values); var response = client.PostAsync("http://pw.heck.today/login", content).Result; var contentMessage = response.Content.ReadAsStringAsync().Result; error = ApiError.FromResponse(response).Result; if (error == null) { return(UserToken.FromJson(contentMessage)?.AccessToken); } return(""); } }