может получить токен доступа от мастера постов, но через код, который он показывает как неавторизованный ... любая идея? `
client.BaseAddress = new Uri(baseUrl);
// We want the response to be JSON.
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new
MediaTypeWithQualityHeaderValue("application/json"));
// Build up the data to POST.
List<KeyValuePair<string, string>> postData = new List<KeyValuePair<string, string>>();
postData.Add(new KeyValuePair<string, string>("grant_type", "client_credentials"));
postData.Add(new KeyValuePair<string, string>("client_id", clientId));
postData.Add(new KeyValuePair<string, string>("client_secret", clientSecret));
client.DefaultRequestHeaders.Add("Authorization", "Basic xxxxxxx");
FormUrlEncodedContent content = new FormUrlEncodedContent(postData);
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// Post to the Server and parse the response.
HttpResponseMessage response = await client.PostAsync("Token", content);
string jsonString = await response.Content.ReadAsStringAsync();
object responseData = JsonConvert.DeserializeObject(jsonString);
// return the Access Token.
return ((dynamic)responseData).access_token;`