当前位置: 首页>>代码示例>>C#>>正文


C# TwitterService.GetAuthorizationUri方法代码示例

本文整理汇总了C#中TweetSharp.TwitterService.GetAuthorizationUri方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterService.GetAuthorizationUri方法的具体用法?C# TwitterService.GetAuthorizationUri怎么用?C# TwitterService.GetAuthorizationUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TweetSharp.TwitterService的用法示例。


在下文中一共展示了TwitterService.GetAuthorizationUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessAuthoriztion

        public LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params)
        {
            var twitterService = new TwitterService(KeyStorage.Get("twitterKey"), KeyStorage.Get("twitterSecret"));

            if (String.IsNullOrEmpty(context.Request["oauth_token"]) ||
                String.IsNullOrEmpty(context.Request["oauth_verifier"]))
            {
                var requestToken = twitterService.GetRequestToken(context.Request.Url.AbsoluteUri);

                var uri = twitterService.GetAuthorizationUri(requestToken);

                context.Response.Redirect(uri.ToString(), true);
            }
            else
            {
                var requestToken = new OAuthRequestToken { Token = context.Request["oauth_token"] };
                var accessToken = twitterService.GetAccessToken(requestToken, context.Request["oauth_verifier"]);
                twitterService.AuthenticateWith(accessToken.Token, accessToken.TokenSecret);

                var user = twitterService.VerifyCredentials(new VerifyCredentialsOptions());

                return ProfileFromTwitter(user);
            }

            return new LoginProfile();

        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:27,代码来源:TwitterLoginProvider.cs

示例2: GetUserToken

        public static void GetUserToken(TwitterService service)
        {
            // Step 1 - Retrieve an OAuth Request Token
            OAuthRequestToken requestToken = service.GetRequestToken();

            // Step 2 - Redirect to the OAuth Authorization URL
            Uri uri = service.GetAuthorizationUri(requestToken);

            Console.WriteLine("Enter this uri into a browser:\n{0}", uri.ToString());

            Console.WriteLine("Enter the pin given by twitter");

            // Step 3 - Exchange the Request Token for an Access Token
            string verifier = Console.ReadLine(); // <-- This is input into your application by your user
            OAuthAccessToken access = service.GetAccessToken(requestToken, verifier);

            if(access == null)
            {
                Console.WriteLine("no tokens returned");
                return;
            }

            Console.WriteLine("Access Token:\n{0}", access.Token);
            Console.WriteLine("Access Secret:\n{0}", access.TokenSecret);

            // Step 4 - User authenticates using the Access Token
            service.AuthenticateWith(access.Token, access.TokenSecret);
        }
开发者ID:mikehadlow,项目名称:socsnap,代码行数:28,代码来源:Main.cs

示例3: Login

 public ActionResult Login(string returnUrl)
 {
     var service = new TwitterService(ConsumerKey, ConsumerSecret);
     var requestToken = service.GetRequestToken(Url.Action("LoginCallback", "Auth", new {returnUrl}, Request.Url.Scheme));
     var uri = service.GetAuthorizationUri(requestToken);
     return Redirect(uri.ToString());
 }
开发者ID:RomanGorgol,项目名称:nosql,代码行数:7,代码来源:AuthController.cs

示例4: Main

        static void Main(string[] args)
        {
            var _consumerKey = ConfigurationManager.AppSettings["twitterConsumerKey"].ToString();
            var _consumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"].ToString();

            // configure access token
            //var _accessToken = ConfigurationManager.AppSettings["twitterAccess"].ToString();
            //var _accessTokenSecret = ConfigurationManager.AppSettings["twitterAccessSecret"].ToString();

            service = new TwitterService(_consumerKey, _consumerSecret);

            // Step 1 - Retrieve an OAuth Request Token
            OAuthRequestToken requestToken = service.GetRequestToken();

            // Step 2 - Redirect to the OAuth Authorization URL
            Uri uri = service.GetAuthorizationUri(requestToken);
            Process.Start(uri.ToString());

            // Step 3 - Exchange the Request Token for an Access Token
            string verifier = "123456"; // <-- This is input into your application by your user
            OAuthAccessToken access = service.GetAccessToken(requestToken, verifier);

            // Step 4 - User authenticates using the Access Token
            service.AuthenticateWith(access.Token, access.TokenSecret);

            //service.AuthenticateWith(_accessToken, _accessTokenSecret);

            //SendATweet();
            //GeoLocationLookup();
            ListFollowers();

            Console.ReadKey();
        }
开发者ID:ericnelson1,项目名称:twitter-app,代码行数:33,代码来源:Program.cs

示例5: GetFavorites

        public IEnumerable<TwitterStatus> GetFavorites()
        {
            var service = new TwitterService(Config.Twitter.ConsumerKey, Config.Twitter.ConsumerSecret);

            // Step 1 - Retrieve an OAuth Request Token
            var requestToken = service.GetRequestToken();

            // Step 2 - Redirect to the OAuth Authorization URL
            var uri = service.GetAuthorizationUri(requestToken);
            Process.Start(uri.ToString());

            // Step 3 - Exchange the Request Token for an Access Token
            Console.Write("Please, your key? ");
            var verifier = Console.ReadLine(); // <-- This is input into your application by your user
            var access = service.GetAccessToken(requestToken, verifier);

            // Step 4 - User authenticates using the Access Token
            service.AuthenticateWith(access.Token, access.TokenSecret);

            var users = service.SearchForUser("kellogh");
            if (users == null)
            {
                Console.WriteLine("No users found");
                yield break;
            }

            var user = users.First();

            var favorites = service.ListFavoriteTweetsFor(user.Id);

            foreach (var tweet in favorites)
            {
                yield return tweet;
            }
        }
开发者ID:tkellogg,项目名称:TweetDigest,代码行数:35,代码来源:TwitterHelpers.cs

示例6: GetAutheticationUri

        public Uri GetAutheticationUri(IDictionary<string, string> parameters, Uri callback)
        {
            var callbackUri = new UriBuilder(callback)
            {
                Query = string.Format("context={0}", parameters["wctx"])
            };

            // Pass your credentials to the service
            string consumerKey = _settings.TwitterConsumerKey;
            string consumerSecret = _settings.TwitterConsumerSecret;

            var service = new TwitterService(consumerKey, consumerSecret);

            // Retrieve an OAuth Request Token
            string returnUri = callbackUri.ToString();
            OAuthRequestToken requestToken;

            try
            {
                requestToken = service.GetRequestToken(returnUri);
            }
            catch (ArgumentException e)
            {
                string message = string.Format("Failed to request twitter auth token, code: {0}, exception: {1}", service.Response.StatusCode, service.Response.InnerException);
                throw new ArgumentException(message, e);
            }

            // Redirect to the OAuth Authorization URL
            return service.GetAuthorizationUri(requestToken);
        }
开发者ID:GusLab,项目名称:video-portal,代码行数:30,代码来源:TwitterSecurityTokenService.cs

示例7: GetAuthorizationUri

 public static string GetAuthorizationUri()
 {
     var service = new TwitterService(ConsumerToken.ConsumerKey,
         ConsumerToken.ConsumerSecret);
     var requestToken = service.GetRequestToken();
     var uri = service.GetAuthorizationUri(requestToken, "http://127.0.0.1:1400/#/twitter-tokens'");
     return uri.ToString();
 }
开发者ID:Stelmashenko-A,项目名称:CourseWork,代码行数:8,代码来源:TwitterOauth.cs

示例8: OAuth

        public OAuth()
        {
            _consumerKey = ConfigurationManager.AppSettings["ConsumerKey"];
            _consumerSecret = ConfigurationManager.AppSettings["ConsumerSecret"];
            TwitterService service = new TwitterService(_consumerKey, _consumerSecret);

            _requestToken = service.GetRequestToken();
            _uri = service.GetAuthorizationUri(_requestToken);
        }
开发者ID:ankitb,项目名称:TweetOBox,代码行数:9,代码来源:OAuth.cs

示例9: OnLoad

 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     _twitterService = new TwitterService(Constants.ConsumerKey,
         Constants.ConsumerSecret);
     _requestToken = _twitterService.GetRequestToken();
     //_applicationCredentials = CredentialsCreator.GenerateApplicationCredentials);
     _url = _twitterService.GetAuthorizationUri(_requestToken).ToString();
 }
开发者ID:crashracer,项目名称:Sdl-Community,代码行数:9,代码来源:TwitterAccountSetup.cs

示例10: Authorize

        public ActionResult Authorize()
        {
            // Step 1: Retrieve an OAuth Request Token
            _service = new TwitterService(key, secret);
            OAuthRequestToken requestToken = _service.GetRequestToken("http://localhost:9090/AuthorizeCallback");

            // Step 2: Redirect to the OAuth Authorization URL
            Uri uri = _service.GetAuthorizationUri(requestToken);
            return new RedirectResult(uri.ToString(), false /*permanent*/);
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:10,代码来源:TpTwitter.cs

示例11: GetTwitterService

 private static TwitterService GetTwitterService(Tuple<string, string> authKeys)
 {
     TwitterService service = new TwitterService(authKeys.Item1, authKeys.Item2);
     OAuthRequestToken requestToken = service.GetRequestToken();
     Uri uri = service.GetAuthorizationUri(requestToken);
     var taw = new TwitterAuth() { AuthUrl = uri };
     taw.ShowDialog();
     OAuthAccessToken access = service.GetAccessToken(requestToken, taw.Token);
     service.AuthenticateWith(access.Token, access.TokenSecret);
     return service;
 }
开发者ID:holdensmagicalunicorn,项目名称:Rx-Demo,代码行数:11,代码来源:TwitterFeedBase.cs

示例12: GetConnectedWithTwitter

        public ActionResult GetConnectedWithTwitter()
        {
            string _consumerKey = System.Configuration.ConfigurationManager.AppSettings["consumerKeyLogin"];
            string _consumerSecret = System.Configuration.ConfigurationManager.AppSettings["consumerSecretLogin"];
            TwitterService service = new TwitterService(_consumerKey, _consumerSecret);

            OAuthRequestToken requestToken = service.GetRequestToken();

            var uri = service.GetAuthorizationUri(requestToken);
            return new RedirectResult(uri.ToString(), false /*permanent*/);
        }
开发者ID:emiprotech,项目名称:loginwithtwitter,代码行数:11,代码来源:HomeController.cs

示例13: launchTwitterAppButton_Click

        private void launchTwitterAppButton_Click(object sender, RoutedEventArgs e)
        {
            // Pass your credentials to the service
            service = new TwitterService("rfeDMlcxMQSqDSdmXDT3A", "7ZUD4YtVqOfFJcCHwWz7q0qTFjcKyVGSNyN4ElCsZZE");

            // Step 1 - Retrieve an OAuth Request Token
            requestToken = service.GetRequestToken();

            // Step 2 - Redirect to the OAuth Authorization URL
            Uri uri = service.GetAuthorizationUri(requestToken);
            Process.Start(uri.ToString());
        }
开发者ID:sayan801,项目名称:DailyNoteBook,代码行数:12,代码来源:MainWindow.xaml.cs

示例14: Authorize

        public ActionResult Authorize()
        {
            var twitterService = new TwitterService(TwitterAuthentication.Key, TwitterAuthentication.Secret);

            var requestToken = twitterService.GetRequestToken();

            Session["RequestToken"] = requestToken;

            var uri = twitterService.GetAuthorizationUri(requestToken);

            return new RedirectResult(uri.ToString());
        }
开发者ID:timothyclifford,项目名称:Hackathon,代码行数:12,代码来源:TwitterController.cs

示例15: GetLoginUrl

        public string GetLoginUrl()
        {
            // Step 1 - Retrieve an OAuth Request Token
            var service = new TwitterService(ConfigurationManager.AppSettings["twitterConsumerKey"], ConfigurationManager.AppSettings["twitterConsumerSecret"]);

            // This is the registered callback URL
            var requestToken = service.GetRequestToken(ConfigurationManager.AppSettings["twitterCallbackUrl"]);

            // Step 2 - Redirect to the OAuth Authorization URL
            var uri = service.GetAuthorizationUri(requestToken);
            return uri.ToString();
        }
开发者ID:pdrm6000,项目名称:RepoTest,代码行数:12,代码来源:TwitterAuthenticationService.cs


注:本文中的TweetSharp.TwitterService.GetAuthorizationUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。