【发布时间】:2021-11-26 06:40:06
【问题描述】:
我无法让 IdentityModel 验证令牌是否仍有有效会话。这是我的客户代码。 _http 是 HttpClient 的一个实例。
不要因为在这种情况下使用用户名/密码而评判我。这是一个受信任的应用程序,我首先从更简单的场景开始,然后计划转向混合模型。
var discovery ??= await _http.GetDiscoveryDocumentAsync("http://localhost:5000");
var response = await _http.RequestPasswordTokenAsync(new PasswordTokenRequest
{
Address = discovery.TokenEndpoint,
ClientId = ClientId,
ClientSecret = ClientSecret,
Scope = "api1",
UserName = "test",
Password = "test"
}); // This succeeds while returning an AccessToken
var introspectionResponse = await _http.IntrospectTokenAsync(new TokenIntrospectionRequest
{
Address = discovery.IntrospectionEndpoint,
ClientId = ClientId,
ClientSecret = ClientSecret,
Token = response.AccessToken
}); // This fails with an unauthenticated error
【问题讨论】:
标签: c# .net identityserver4 identitymodel