【发布时间】:2014-04-26 08:10:18
【问题描述】:
我有一个基于 SPA VS 2013 模板的 Web Api 2 项目。我在该 API 中配置了不记名令牌身份验证。
我还有一个单独的 MVC 5 项目,我想使用该 Web Api 进行身份验证。那可能吗?怎么样?
到目前为止我做了什么(在我的 Mvc 客户端中):
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)
{
//
}
}
它得到了令牌,但现在呢?
【问题讨论】:
标签: asp.net-mvc asp.net-web-api owin