我正在尝试验证ValidateClientAuthentication函数中的客户端ID.我正在使用grant_type =密码流.以下是我在auth令牌请求正文中传递client_id的方法.
Content-Type: application/x-www-form-urlencoded
grant_type=password&username=user1@test.com&password=pwduser1&client_id=B36B-07DEAC802BEA
Run Code Online (Sandbox Code Playgroud)
当我尝试访问ClientId以验证客户端ID时,它始终为null.
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");
}
Run Code Online (Sandbox Code Playgroud)
当grant_type = password时,将客户端ID传递给令牌端点的正确方法是什么?
感谢您的帮助.