Search code examples
c#wpfauthenticationtwittertweetsharp

tweet sharp authentication don't return access token


tweet sharp authentication don't return access token when i make authentication with my account access token back (Y) but when i use another account no access token back ? this is code

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

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);


           }
        }

any one can help


Solution

  • i found the solution thanks....

    just download tweet sharp unofficial from nugget its solve the problem

    and i find the problem in the tweetsharp.service.getaccesstoken("",pintxt);

    when back the user profile user id is long than int64 so the new users in twitter and user id taller than or users that less than well back null so in the unofficial tweetsharp they solve that problem