【问题标题】:'Client secret validation failed for client' error on identity server 4身份服务器 4 上的“客户端密码验证失败”错误
【发布时间】:2021-05-25 16:22:43
【问题描述】:

我正在尝试使用 client_credentials 从我的 Identity Server 4 获取访问令牌,我想我几乎通过搜索完成了 Google 页面,但我什么也没找到。所以请:

这是我的 GetClients 方法

[![在此处输入图片描述][1]][1]我的邮递员请求,在标题中我只有Content_Type,即application/x-www-form-urlencoded

还有错误:

【问题讨论】:

  • 无论如何,https 不是问题,我在 HTTP 上也遇到同样的错误

标签: asp.net-core identityserver4


【解决方案1】:

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

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

秘密必须经过哈希处理。

简单测试

curl https://localhost:5001/connect/token -d "grant_type=client_credentials&client_id=azure-client-id&client_secret=test"

和

curl https://localhost:5001/connect/token -H "授权:基本 YXp1cmUtY2xpZW50LWlkOnRlc3Q=" -d "grant_type=client_credentials"

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2012-08-28
  • 1970-01-01
  • 1970-01-01
  • 2011-11-04
  • 2021-11-10
  • 2019-06-27
  • 2012-04-15
  • 1970-01-01
相关资源
最近更新 更多