身份模型 invalid_client

Identity Model invalid_client

我刚开始学习身份模型,一直在看这里的例子 - https://identitymodel.readthedocs.io/en/latest/client/token.html

我正在查看最简单的示例 - 使用 client_credentials 授权类型请求令牌 - 并使用示例代码我将一些简单的 vb.net 放在一起进行测试和试验。

我遇到的问题是我只收到 invalid_client 错误消息。

我敢肯定我遗漏了一些明显的东西,但如果有人能给我指出正确的方向,那将非常有帮助。

Dim request As New ClientCredentialsTokenRequest
request.Address = "https://demo.identityserver.io/connect/token"
request.ClientId = "client"
request.ClientSecret = "secret"
request.Scope = "api1"

Dim client As New HttpClient        
Dim response As TokenResponse = Await client.RequestClientCredentialsTokenAsync(request)

如@abdusco 的回复所示,正确的代码应该如下所示

Dim request As New ClientCredentialsTokenRequest
request.Address = "https://demo.identityserver.io/connect/token"
request.ClientId = "m2m"
request.ClientSecret = "secret"
request.Scope = "api"

Dim client As New HttpClient        
Dim response As TokenResponse = Await client.RequestClientCredentialsTokenAsync(request)

感谢您的帮助。