コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: CrudApi.cs プロジェクト: AnaNikolic/NFCTimeTracking
 public CrudApi(BearerToken token)
 {
     Token = token;
 }