我正在使用邮递员并发出api post请求,其中我添加了x-www-form-urlencoded键/值的正文,它在邮递员中工作正常.
当我使用RestSharp软件包从c#中尝试它时,问题就出现了.
我在下面尝试了以下代码但没有得到响应.我收到"BadRequest"invalid_client错误.
public class ClientConfig {
public string client_id { get; set; } = "value here";
public string grant_type { get; set; } = "value here";
public string client_secret { get; set; } = "value here";
public string scope { get; set; } = "value here";
public string response_type { get; set; } = "value here";
}
public void GetResponse() {
var client = new RestClient("api-url-here");
var req = new RestRequest("endpoint-here",Method.POST);
var config = new ClientConfig();//values to pass …Run Code Online (Sandbox Code Playgroud)