我正在尝试在他们的文档中提供样本授权请求(或任何需要身份验证的Etsy api).我得到的响应是"oauth_problem = token_rejected".
我用这个苏答案与沿OAuth的基础是benSharper挂钩.
我看着这个和这个,和其他人.其中一个使用https://sandbox.https://openapi.etsy.com/v2
,当我尝试时,例外是"底层连接已关闭:无法建立SSL/TLS安全通道的信任关系." 我部署到我的服务器(这是https),仍然是相同的响应.
似乎无法让它发挥作用.我错过了什么?
这是我的代码:
public class AuthorizedRequestHelper { string baseUrl = "https://openapi.etsy.com/v2"; string relativePath = "/oauth/scopes"; string oauth_consumer_key = "xxx"; string consumerSecret = "xxx"; string oauth_token = "xxx"; string oauth_token_secret = "xxx"; public void test() { var restClient = new RestClient(baseUrl); OAuthBase oAuth = new OAuthBase(); string nonce = oAuth.GenerateNonce(); string timeStamp = oAuth.GenerateTimeStamp(); string normalizedUrl; string normalizedRequestParameters; string sig = oAuth.GenerateSignature(new Uri(baseUrl + relativePath), oauth_consumer_key, consumerSecret, oauth_token, oauth_token_secret, "GET", timeStamp, nonce, out normalizedUrl, out normalizedRequestParameters); var request = new RestRequest(relativePath); request.Resource = string.Format(relativePath); request.Method = Method.GET; request.AddParameter("oauth_consumer_key", oauth_consumer_key); request.AddParameter("oauth_token", oauth_token); request.AddParameter("oauth_nonce", nonce); request.AddParameter("oauth_timestamp", timeStamp); request.AddParameter("oauth_signature_method", "HMAC-SHA1"); request.AddParameter("oauth_version", "1.0"); request.AddParameter("oauth_signature", sig); IRestResponse irestResponse = restClient.Execute(request); var content = irestResponse.Content; // content = oauth_problem=token_rejected } }
任何帮助将不胜感激.