Esempio n. 1
0
        private async Task <string> GetApiToken(string key, string deviceId, string deviceDescription)
        {
            var postParams = new Dictionary <string, string> {
                { "token", key },
                { "deviceId", deviceId },
                { "deviceDescription", deviceDescription }
            };

            var response = await HttpRequest.Post(EndPointHelper.GetLoginTokenURL(), postParams);

            string token = await response.Content.ReadAsStringAsync();

            if (!response.IsSuccessStatusCode || String.IsNullOrEmpty(token))
            {
                throw new Exception("Login Failed");
            }
            else
            {
                return(token);
            }
        }