E
emi1234
Guest
static async Task<string> ApiCallAsync(string token)
{
//should return the response token
String response = "";
var url = "https://api.ciscospark.com/v1/jwt/login";
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
try
{ //requesting a guest token
// httpClient.DefaultRequestHeaders.ExpectContinue = false;
var responseMessage = await httpClient.PostAsync(url, null); //calls the post http request- currently throwing exxception
var responseString = await responseMessage.Content.ReadAsStringAsync();
var JSONObj = new JavaScriptSerializer().Deserialize<Dictionary<string, string>>(responseString);
response = JSONObj["token"];
}
catch (Exception ex)
{
Console.WriteLine($"There was an exception: {ex.ToString()}");
}
return response;
}
We solved the issue adding a a line of SSL.
Continue reading...