我刚刚开始学习身份模型,并一直在看这里的例子-https://identitymodel.readthedocs.io/en/latest/client/token.html
我正在看一个最简单的例子——使用client_credentials Grant Type请求令牌——并使用我组装的一些简单的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)
谢谢你的帮助。