我正在尝试使用RestSharp访问 Etsy 的 API。这是我用来尝试获取 OAuth 访问令牌的代码:
var authenticator = OAuth1Authenticator.ForRequestToken(
ConfigurationManager.AppSettings["ApiKey"],
ConfigurationManager.AppSettings["ApiSecret"]);
// same result with or without this next line:
// authenticator.ParameterHandling = OAuthParameterHandling.UrlOrPostParameters;
this.Client.Authenticator = authenticator;
var request = new RestRequest("oauth/request_token")
.AddParameter("scope", "listings_r");
var response = this.Client.Execute(request);
Etsy 告诉我签名无效。有趣的是,当我将请求生成的时间戳和 nonce 值输入此OAuth 签名验证工具时,签名不匹配。此外,该工具生成的 URL 可以与 Etsy 一起使用,而 RestSharp 生成的 URL 不能。有什么我做错了,或者我需要用 RestSharp 配置什么?
注意:我使用的是他们的 Nuget 包提供的 RestSharp 版本,在发布这篇文章时是 102.5。