小编Shi*_*ath的帖子

在ValidateClientAuthentication中,client_id始终为null

我正在尝试验证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传递给令牌端点的正确方法是什么?

感谢您的帮助.

c# oauth-2.0 asp.net-web-api owin

7
推荐指数
1
解决办法
6641
查看次数

标签 统计

asp.net-web-api ×1

c# ×1

oauth-2.0 ×1

owin ×1