I have a Web Api 2 project based on the SPA VS 2013 template. I have bearer token authentication configured in this Api.
I also have a separate MVC 5 project, I want to authenticate with this web api. Is it possible? How?
What I have done so far (in my Mvc client):
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://localhost/MyApi/");
var response = client.PostAsync("Token", new StringContent("grant_type=password&username=teste&password=123456", Encoding.UTF8)).Result;
if (response.IsSuccessStatusCode)
{
}
}
He received a token, but now what?
source
share