我正在尝试使用client_credentials从Identity Server 4获取访问令牌,我认为我几乎用搜索完成了Google页面,却一无所获。所以请:
这是我的GetClients方法
我的PostMan请求,在标头中我只有
Content_Type
,即application/x-www-form-urlencoded
错误:
答案 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“