/Token bad request

I am trying to make a post call to get the token using /token API
I am doing this using .net core.
the call works when I do it using postman

here are the parameters I am passing

Here are the headers I am passing

the authorization header is the client_id and client_Secret 64 encoded
postman returns a token back

Now I am trying to do this programmatic in .net core. But I keep getting bad request. what am I doing wrong. here is the code making the call

public async Task InvokeAsync(HttpContext context)

            if (context.Request.Path.Equals("/signin-oidc"))
               var query = context.Request.Query["code"];
               using (HttpClient tokenClient = new HttpClient())
                    string url = "https://{domain}.oktapreview.com/oauth2/afsfjru5uvj6eHSM9c0h7/v1/token";

                    var parameters = new Dictionary<string, string> { { "redirect_uri", _config.redirectUri }, { "code", query }, { "grant_type", "authorization_code" } };
                    var encodedContent = new FormUrlEncodedContent(parameters);

                    tokenClient.DefaultRequestHeaders.Add("Accept", "application/json");
                    string secretsEncoded = Base64Encode(_config.clientId + ":" + _config.clientSecret);
                    tokenClient.DefaultRequestHeaders.Add("authorization", "Basic " + secretsEncoded);

                    var task = tokenClient.PostAsync(url, encodedContent);
                    var result = task.Result;

This is resolved
with postman I have to provide the header Basic encoded64(client_id:client_secret)

when I do it from the code I need to include client_id and client_secret in the body without encoding