加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows-phone-7 – 使用RestSharp对Trello API进行身份验证

发布时间:2020-12-14 05:28:29 所属栏目:Windows 来源:网络整理
导读:我正在努力弄清楚如何从我的 Windows Phone 7应用程序中使用Trello的OAuth API调用.除了 listing of the endpoints之外,API没有真正记录. 这是我到目前为止所拥有的: public void OnAuthenticateClicked(object sender,EventArgs e){ const string consumer
我正在努力弄清楚如何从我的 Windows Phone 7应用程序中使用Trello的OAuth API调用.除了 listing of the endpoints之外,API没有真正记录.

这是我到目前为止所拥有的:

public void OnAuthenticateClicked(object sender,EventArgs e)
{
    const string consumerKey = "mykey";
    const string consumerSecret = "mysecret";
    const string baseUrl = "https://trello.com/1";

    var client = new RestClient(baseUrl) 
    {
        Authenticator = OAuth1Authenticator.ForRequestToken(consumerKey,consumerSecret)
    };
    var request = new RestRequest("OAuthGetRequestToken",Method.POST);
    var response = client.ExecuteAsync(request,HandleResponse);
}

private void HandleResponse(IRestResponse restResponse)
{
    var response = restResponse;
    Console.Write(response.StatusCode);
}

我得到了404响应,显然有些事情是不对的.

有什么建议?

解决方法

不使用ExecuteAsync似乎使它工作:

RestRequest request = new RestRequest("OAuthGetRequestToken",Method.POST);
IRestResponse response = client.Execute(request);
Console.Write(response.StatusCode);

根据John Sheehan的this post,在某一点上“异步方案(SL和WP)尚未支持oAuth1”.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读