public async Task <BearerToken> AuthentificateAsync(Uri url, LogInBody o) { var client = new HttpClient(); var content = new StringContent(GetURLstringFromBody(o), Encoding.UTF8, "application/x-www-form-urlencoded"); HttpResponseMessage response = null; response = await client.PostAsync(url, content); if (!response.IsSuccessStatusCode) { return(null); } var result = await response.Content.ReadAsStringAsync(); IsoDateTimeConverter dateTimeConverter = new IsoDateTimeConverter { DateTimeFormat = "R" }; BearerToken b = JsonConvert.DeserializeObject <BearerToken>(result, dateTimeConverter); return(b); }
public CrudApi(BearerToken token) { Token = token; }