1
OAuth2
APIをスコープパラメータセットt o read,usercp
でコールしようとしています。しかしRestSharpは常に&scope=read%2Cusercp
にパラメータをエンコードします。代わりに&scope=read,usercp
RestSharpパラメータのコード化を防止する
私はまだ単一のパラメータのエンコードを無効にする方法を見つけていません。
は、ここに私のコードです:
var request = GetRequest("index.php?oauth/token", Method.POST);
request.AddParameter("client_id", ClientId);
request.AddParameter("client_secret", ClientSecret);
request.AddParameter("grant_type", "password");
request.AddParameter("username", username);
request.AddParameter("password", password);
request.AddParameter("scope", "read,usercp");
//request.Parameters.Add(new Parameter
//{
// ContentType = "application/json",
// Name = "scope",
// Value = "read,usercp"
//});
var response = await RestClient.ExecuteTaskAsync<AuthenticateResponse>(request);
if (response.StatusCode != HttpStatusCode.OK &&
response.StatusCode != HttpStatusCode.Accepted)
{
throw new Exception("Could not authenticate user");
}
私は、単一のパラメータのエンコーディングを無効にするにはどうすればよいですか?
[この]に基づいて(http://stackoverflow.com/ A/22166701/4499267)答え、彼らは常にエンコードされているようです。 githubに関する未解決の問題も見つかりました:http://github.com/restsharp/RestSharp/issues/892 – Phate01
@ Phate01ありがとうございます。たぶんそこには回避策がありますか?私は見つけられないようです。 – SeToY