Exemplo n.º 1
0
        public void PreAuthorization()
        {
            requestToken = service.GetRequestToken();
            Uri uri = service.GetAuthorizationUri(requestToken);

            Process.Start(uri.ToString());
        }
Exemplo n.º 2
0
        static void InitUserAuthentication()
        {
            var requestToken = _twitterService.GetRequestToken();
            var uri          = _twitterService.GetAuthorizationUri(requestToken);

            Process.Start(uri.ToString());
            Console.Write("For using your twitter account in application please enter verification code from twitter auth: ");
            var verifier        = Console.ReadLine();
            var userAccessToken = _twitterService.GetAccessToken(requestToken, verifier);

            _twitterService.AuthenticateWith(userAccessToken.Token, userAccessToken.TokenSecret);
            _isUserAuthenticated = true;
        }
Exemplo n.º 3
0
        public ActionResult GetSearchResults(string query)
        {
            OAuthRequestToken requestToken = _twitterService.GetRequestToken();

            _twitterService.AuthenticateWith("796903847738404864-Mr5l9qUYaZVxChJsOxCjjUo6m2U9vlR", "0TPcZ1cp0EObV0GGRpApcC6133MRMJBGcnLvYbpuwaQ3D");

            var results = _twitterService.Search(new SearchOptions()
            {
                Q = query, Resulttype = TwitterSearchResultType.Popular, Count = 20
            });

            return(View(results));
        }
Exemplo n.º 4
0
        public void Authorize(Func <Uri, string, string> func)
        {
            _twitterService = new TwitterService(_options.ConsumerKey, _options.ConsumerSecret);
            if (string.IsNullOrWhiteSpace(_options.OauthToken) && string.IsNullOrWhiteSpace(_options.OauthTokenSecret))
            {
                var requestToken = _twitterService.GetRequestToken();
                var uri          = _twitterService.GetAuthenticationUrl(requestToken);

                var verifier = func(uri, "Введите PIN");
                var access   = _twitterService.GetAccessToken(requestToken, verifier);
                _options.SetOauthTokens(access.Token, access.TokenSecret);
            }
            _twitterService.AuthenticateWith(_options.OauthToken, _options.OauthTokenSecret);
        }
Exemplo n.º 5
0
 public TwitterTokenResponse GetTwitterRequestToken()
 {
     return(_twitterService.GetRequestToken());
 }