Can';在WindowsPhone7上使用oAuth和.NETHammock库更新twitter状态

Can';在WindowsPhone7上使用oAuth和.NETHammock库更新twitter状态,twitter,oauth,windows-phone-7,Twitter,Oauth,Windows Phone 7,我已经能够设置oAuth调用以获取用户访问令牌,如下几篇博文: 及 :/byatool.com/c/使用吊床csharp/comment-page-1/#comment-9955将您的web应用程序连接到twitter 但我在发送状态更新时遇到问题。我找不到任何示例,因此可能没有设置正确的值。下面是不断返回的代码:“无法通过OAuth进行身份验证。” 谢谢你的帮助, Sam啊,终于发现我使用了错误的URL,需要使用: Authority=“”而非:“以防万一,我已经在Twitter上使用吊床宣

我已经能够设置oAuth调用以获取用户访问令牌,如下几篇博文:

及 :/byatool.com/c/使用吊床csharp/comment-page-1/#comment-9955将您的web应用程序连接到twitter

但我在发送状态更新时遇到问题。我找不到任何示例,因此可能没有设置正确的值。下面是不断返回的代码:“无法通过OAuth进行身份验证。”

谢谢你的帮助,
Sam

啊,终于发现我使用了错误的URL,需要使用:


Authority=“”而非:“

以防万一,我已经在Twitter上使用吊床宣誓。可能对某些人有用

private void Tweet()
{
    var credentials = new OAuthCredentials
                            {
                                Type = OAuthType.ProtectedResource,
                                SignatureMethod = OAuthSignatureMethod.HmacSha1,
                                ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
                                ConsumerKey = TwitterSettings.ConsumerKey,
                                ConsumerSecret = TwitterSettings.ConsumerKeySecret,
                                Token = _settings.AccessToken,
                                TokenSecret = _settings.AccessTokenSecret,
                                Version = TwitterSettings.OAuthVersion,
                            };

    var client = new RestClient
    {
        Authority = "http://twitter.com/oauth",
        Credentials = credentials,
        HasElevatedPermissions = true
    };

    var request = new RestRequest
    {
        Path = "/statuses/update.json",
        Method = WebMethod.Post
    };

    request.AddParameter("status", TwitterTextBox.Text);

    client.BeginRequest(request, new RestCallback(TwitterPostCompleted));
}

private void TwitterPostCompleted(RestRequest request, RestResponse response, object userstate)
{
    Dispatcher.BeginInvoke(() => MessageBox.Show(response.Content));
}