1

我正在尝试使用 RestSharp 编写 OAuth 1 REST 客户端,但在 GET 请求中遇到了一些无效签名问题。我单步执行了代码,似乎问题在于,对于 GET 请求,签名基本字符串中省略了请求参数。特别是,OAuth1Authenticator.cs 中的违规代码是这样的:

// for non-GET style requests make sure params are part of oauth signature
if (request.Method != Method.GET && request.Method != Method.DELETE)
{
    foreach (var p in request.Parameters.Where(p => p.Type == ParameterType.GetOrPost))
    {
        parameters.Add(new WebPair(p.Name, p.Value.ToString()));
    }
}

如果我删除 if 语句,它会按预期工作。

我是不是误会了什么?基于此处 OAuth 规范中的签名基本字符串示例:http: //oauth.net/core/1.0a/#sig_base_example,看起来应该将这些参数添加到基本签名中。这是 OAuth1Authenticator 中的错误,还是我做错了什么?

谢谢!

4

0 回答 0