Rah*_*hul 5 c# restsharp jwt thinktecture-ident-server asp.net-web-api2
我正在使用以下代码从Asp.net Web Api 2.2服务中使用JWT访问令牌.我已按照本文在Web Api服务中设置授权服务器.我在客户端使用RestSharp.
客户代码:
var client = new RestClient(http://localhost:58030);
client.Timeout = 30000;
var request = new RestRequest(@"/Oauth/Token", Method.POST);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddHeader("grant_type", "password");
request.AddHeader("username", "admin@example.com");
request.AddHeader("password", "Admin@456");
IRestResponse response = client.Execute(request);
result = response.Content;
Run Code Online (Sandbox Code Playgroud)
结果我得到以下错误:
{
"error_description":"grant type not supported",
"error":"unsupported_grant_type"
}
Run Code Online (Sandbox Code Playgroud)