我一直在试图让IdentityServer4的最简单的例子,以请求落后于纯代码的访问工作。使用客户端请求,但没有做一个用户登录的时候,当我可以得到一个访问令牌..IdentityServer4 unsupported_grant_type错误
var discos = new DiscoveryClient(authority);
var disco = await discos.GetAsync();
if (disco.IsError)
{
Console.WriteLine(disco.Error);
return null;
}
var tokenClient = new TokenClient(disco.TokenEndpoint, "ro.client", "secret");
var tokenResponse = await tokenClient.RequestResourceOwnerPasswordAsync("username", "password", "api1");
这使得使用用户信息请求的客户端。 我得到一个永久的unsupported_grant_type ..
服务器有它设置为:
new Client
{
ClientId = "ro.client",
AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,
ClientSecrets =
{
new Secret("secret".Sha256())
},
AllowedScopes = { "api1" }
}
任何人都可以请鉴定一下林mising。用户可以登录使用前端快速启动界面,该软件提供,这是内置的功能。为什么不会,如果该公司是有效发挥作用。
你使用内存的用户? –
检查日志... – leastprivilege