身份服务器4上的“客户端的客户端机密验证失败”错误

时间:2019-05-21 10:42:45

标签: asp.net-core identityserver4

我正在尝试使用client_credentials从Identity Server 4获取访问令牌,我认为我几乎用搜索完成了Google页面,却一无所获。所以请:

这是我的GetClients方法

enter image description here我的PostMan请求,在标头中我只有Content_Type,即application/x-www-form-urlencoded enter image description here

错误:

enter image description here

1 个答案:

答案 0 :(得分:2)

您从正确的代码行开始:"secret".Sha256(),但后来忘记了它。
请尝试以下操作:

var secret = new Secret {Value = "test".Sha512()};
ClientSecrets = new[] {secret};

必须对秘密进行哈希处理。

经过

的简短测试
  

卷曲https://localhost:5001/connect/token -d“ grant_type = client_credentials&client_id = azure-client-id&client_secret = test”

  

卷曲https://localhost:5001/connect/token -H“授权:基本YXp1cmUtY2xpZW50LWlkOnRlc3Q =“ -d” grant_type = client_credentials“

相关问题