I can't get IdentityModel to validate if the token still has a valid session. Here's my client code. _http
is an instance of HttpClient
.
Don't judge me on using username/password in this instance. It's with a trusted application and I'm starting off with the easier scenario first with plans to move on to the hybrid model next.
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