In Dos Commandline we run the following curl command in order to generate an access token which works quite well:
C:\temp>curl --user YOUR_SITE_ID :YOUR_API_KEY -d grant_type=client_credentials -d scope=accounts --cacert certfromcurlwebsite.crt https://blah.blahyada.com/oauth2/token
We are trying to imitate the cUrl invocation shown above using ASP.NET WebClient, but it gives me a 401 status error:
using (WebClient client = new WebClient())
{
// use System.Net.WebClient, which is the simplest interface for downloading resources in .NET.
client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
String accessTokenGenerationEndpointURI = "https://blah.blahyada.com/oauth2/token";
Str ...
Go to the complete details ...