eBay访问令牌authorization_code沙箱显示内部服务器错误

时间:2020-09-08 11:51:15

标签: c# asp.net rest ebay-api

重定向URL也是https,并且相同的代码在另一个站点上也能很好地运行,但是它如何给我内部服务器错误并且没有响应内容

string authorizationCode = Request.QueryString["Code"].ToString();
var client = new RestClient(baseUrl + "identity/v1/oauth2/token");
var request = new RestRequest(Method.POST);
string authorizationRawValue = string.Format(@"{0}:{1}", clientId, clientSecret);
byte[] authorizationArrayValue = system.Text.ASCIIEncoding.ASCII.GetBytes(authorizationRawValue);
string authorization = System.Convert.ToBase64String(authorizationArrayValue);

//req header
request.AddHeader("Authorization", "Basic " + authorization);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");

//body parameter
request.AddParameter("undefined", string.Format("grant_type=authorization_code&code={0}&redirect_uri={1}", authorizationCode, ruName), ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

0 个答案:

没有答案