Hello,
I’m getting a 200 status from the code below, but not able to find the JWT token in the response. I’m somewhat new to .NET Core’s HttpClient, would appreciate help on extracting the jwt token using .NET
HttpClient client = new HttpClient();
string url = "https://MYDOMAIN.auth0.com/oauth/token";
string body = "{\"client_id\":\"957...MYIDTOKEN...wRU\",\"client_secret\":" +
"\"zbV...MYSECRETTOKEN...tuj\"," +
"\"audience\":\"https://MYDOMAIN.auth0.com/api/v2/\",\"grant_type\":\"client_credentials\"}";
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, url);
client.DefaultRequestHeaders.Accept
.Add(new MediaTypeWithQualityHeaderValue("application/json")); //ACCEPT header
request.Content = new StringContent(body,Encoding.UTF8, "application/json");
// This returns 200 OK
HttpResponseMessage response = await client.PostAsync(url, request.Content);
// Can't see the jwt token in either of these.
HttpContent content = response.Content;
HttpResponseHeaders header = response.Headers;