【发布时间】:2016-09-04 07:14:36
【问题描述】:
我正在尝试在 ValidateClientAuthentication 函数中验证客户端 ID。我正在使用 grant_type=password 流。这是我在身份验证令牌请求正文中传递 client_id 的方式。
Content-Type: application/x-www-form-urlencoded
grant_type=password&username=user1@test.com&password=pwduser1&client_id=B36B-07DEAC802BEA
当我尝试访问 ClientId 以验证客户端 ID 时,它始终为空。
if (context.ClientId != null)
{
//Set the client who initiated request is valid
context.Validated();
}
else
{
//reject access to application
context.Rejected();
context.SetError("Invalid client_id", "Client_id must present in the request header");
}
当 grant_type=password 时,将客户端 ID 传递给令牌端点的正确方法是什么?
感谢您的帮助。
【问题讨论】:
标签: c# asp.net-web-api oauth-2.0 owin