Remote token validation in c#

Hi! I want to implement access token validation remotely and I’m pretty new to Okta stuff. How could I use introspect endpoint to do that in c#? My actual implementation looks like this:

var oktaTokenValidationResult = await oktaClient.PostAsync(new Okta.Sdk.HttpRequest
{
Uri = “/oauth2/v1/introspect”,
QueryParameters = new Dictionary<string, object>()
{
[“token”] = accessToken,
[“token_type_hint”] = “access_token”
},
Headers = new Dictionary<string, string>()
{
[“Accept”] = “application/json”,
[“ContentType”] = “application/x-www-form-urlencoded”
}
});

As a response, I receive a Bad Request: Okta.Sdk.Abstractions.OktaApiException: Bad request. Accept and/or Content-Type headers likely do not match supported values. (400,

Any suggestion would be helpful, Thank you in advance.

I tried another approach, but I receive 401 Unauthorized. I checked the clientId and the accessToken and they seem to be correct. Any ideas?

         var accessToken = "";
        var oktaClientId = "";

        using (HttpClient client = new HttpClient())
        {
            var requestContent = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair<string, string>("token", accessToken),
            });

            string base64Auth = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes($"{oktaClientId}"));
            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", base64Auth);
            var response = await client.PostAsync("https://your-okta-domain/oauth2/v1/introspect", requestContent);