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

Tru*_*Xax 3 asp.net-core identityserver4

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

这是我的 GetClients 方法

[![请在此输入图像说明] [1] [1]我的邮递员请求,在头我只有Content_Typeapplication/x-www-form-urlencoded 在此处输入图片说明

和错误:

在此处输入图片说明

d_f*_*d_f 5

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

var secret = new Secret {Value = "test".Sha512()};
ClientSecrets = new[] {secret};
Run Code Online (Sandbox Code Playgroud)

秘密必须被散列。

简要测试

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"