tweet sharp authentication不返回访问令牌

时间:2014-04-16 03:44:53

标签: c# wpf authentication twitter tweetsharp

推特敏锐的身份验证不会返回访问令牌 当我使用我的帐户访问令牌进行身份验证时(Y) 但当我使用另一个帐户时,没有访问令牌回来? 这是代码

==========================

private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            GetTwitterToken();
        }


private void GetTwitterToken()
        {
            service = new TwitterService(TwitterSettings.ConsumerKey, TwitterSettings.ConsumerKeySecret);
            var cb = new Action<OAuthRequestToken, TwitterResponse>(CallBackToken);
            service.GetRequestToken("oob", CallBackToken);
        }


void CallBackToken(OAuthRequestToken rt, TwitterResponse response)
        {
            Uri uri = service.GetAuthorizationUri(rt);
            _requestToken = rt;
            this.Dispatcher.Invoke((Action)(() => { BrowserControl.Navigate(uri); }));
        }


private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(pinText.Text))
                MessageBox.Show("Please enter PIN");
            else
            {
                try
                {
                    var cb = new Action<OAuthAccessToken, TwitterResponse>(CallBackVerifiedResponse);
                    service.GetAccessToken(_requestToken, pinText.Text, CallBackVerifiedResponse);
                    BrowserControl.Visibility = Visibility.Collapsed;

                }
                catch
                {
                    MessageBox.Show("", "", MessageBoxButton.OK);
                }
            }
        }

void CallBackVerifiedResponse(OAuthAccessToken at, TwitterResponse response)
        {
            if (at != null)
           {


                Settings1.Default.AccessToken = at.Token;
                Settings1.Default.AccessTokenSecret = at.TokenSecret;
                Settings1.Default.ScreenName = at.ScreenName;
                Settings1.Default.UserId = at.UserId.ToString();
                MessageBox.Show(at.ScreenName);


           }
        }

任何人都可以提供帮助

1 个答案:

答案 0 :(得分:0)

我找到了解决方案,谢谢......

只需从nugget下载tweet sharp非官方解决问题

我在tweetsharp.service.getaccesstoken(“”,pintxt)中找到了问题;

当用户配置文件的用户ID长于int64时,所以twitter中的新用户和用户ID高于或低于null的用户,因此在非官方的tweetsharp中他们解决了这个问题