I asked how to set up a call to a service and got a great info on HttpClient. However, while that question's technically answered, I still get stuck.
In the console, I can see what request my browser send to the service to obtain the token for authorization. However, when I try to mimic the call building the request in my service layer, I get the following error message. The probability of me being at fault here is pretty steep. Not sure what to google for, really...
"StatusCode: 500, ReasonPhrase: 'Internal Server Error', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:\u000d\u000a{\u000d\u000a Transfer-Encoding: chunked\u000d\u000a Connection: keep-alive\u000d\u000a Date: Wed, 12 Nov 2014 21:00:34 GMT\u000d\u000a Set-Cookie: lang=\"en\";Max-Age=31622400;expires=Fri, 13-Nov-2015 21:00:33 GMT;Path=/;Version=\"1\"\u000d\u000a Server: nginx/1.4.1\u000d\u000a Server: (Ubuntu)\u000d\u000a Content-Type: text/plain; charset=UTF-8\u000d\u000a}"
The call itself looks like this.
using (HttpClient client = new HttpClient())
{
Task<HttpResponseMessage> message
= client.PostAsync(urlToken, new StringContent(credentials));
message.Wait();
result = message.Result.ToString();
}