public void Authenticate()
        {
            string token          = _credProvider.GetToken();
            string tokenSecret    = _credProvider.GetTokenSecret();
            string consumerKey    = _credProvider.GetConsumerKey();
            string consumerSecret = _credProvider.GetConsumerSecret();

            _service.AuthenticateWith(consumerKey, consumerSecret, token, tokenSecret);
        }
Exemple #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;
        }
Exemple #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));
        }
        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);
        }
Exemple #5
0
        public void VerifyAuthorization(string verifier)
        {
            OAuthAccessToken access = service.GetAccessToken(requestToken, verifier);

            service.AuthenticateWith(access.Token, access.TokenSecret);
        }