C# 使用RestSharp对Bronto REST Api进行身份验证

C# 使用RestSharp对Bronto REST Api进行身份验证,c#,restsharp,bronto,C#,Restsharp,Bronto,我已经在Bronto沙箱中设置了hallmonitor(OAuth 2.0兼容服务),但是使用RestSharp,我无法获得访问令牌,以便能够进一步调用RESTAPI 我已经成功地使用了curl curl -X POST -d "grant_type=client_credentials&client_id=CLIENTID&client_secret=CLIENTSECRET" https://auth.bronto.com/oauth2/token 我尝试了下面代码的许多

我已经在Bronto沙箱中设置了hallmonitor(OAuth 2.0兼容服务),但是使用RestSharp,我无法获得访问令牌,以便能够进一步调用RESTAPI

我已经成功地使用了curl

curl -X POST -d "grant_type=client_credentials&client_id=CLIENTID&client_secret=CLIENTSECRET" https://auth.bronto.com/oauth2/token 
我尝试了下面代码的许多变体,但似乎没有任何效果,我总是得到错误响应

{
    "error_description": "Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method).",
    "error": "unauthorized_client"
}
简化示例代码

var client = new RestClient("https://auth.bronto.com");
client.Authenticator = new HttpBasicAuthenticator(clientId, secret);
//client.Authenticator = new SimpleAuthenticator(CLIENT_ID, clientId, CLIENT_SECRET, secret);

RestRequest request = new RestRequest("/oauth2/token", Method.POST);
//request.AddHeader("Authorization", "Basic " + client);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter(GRANT_TYPE, CLIENT_CREDENTIALS);
//request.AddParameter(CLIENT_ID, clientId);
//request.AddParameter(CLIENT_SECRET, secret);

request.RequestFormat = DataFormat.Json;

IRestResponse response = client.Execute(request);
是否有人使用RestSharp和Bronto REST API成功地进行身份验证并获取访问令牌


非常感谢您的帮助。

这可能会有所帮助:您已经查看了该问题和公认的解决方案,但似乎没有任何指定的解决方案。