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


C# TwitterService.GetAccessToken方法代码示例

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


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

示例1: AuthorizeCallback

        public ActionResult AuthorizeCallback(string oauth_token, string oauth_verifier)
        {
            TwitterService service = new TwitterService(_consumerKey, _consumerSecret);
            var requestToken = new OAuthRequestToken {Token = oauth_token};

            OAuthAccessToken accessToken = service.GetAccessToken(requestToken, oauth_verifier);

            service.AuthenticateWith(accessToken.Token, accessToken.TokenSecret);
            TwitterUser user = service.VerifyCredentials();
            ViewModel.Message = string.Format("Your username is {0}", user.ScreenName);

            return View("Index");
        }
开发者ID:nyxtom,项目名称:tweetsharp,代码行数:13,代码来源:HomeController.cs

示例2: Can_exchange_for_access_token

        public void Can_exchange_for_access_token()
        {
            var service = new TwitterService(_consumerKey, _consumerSecret);
            var requestToken = service.GetRequestToken();

            AssertResultWas(service, HttpStatusCode.OK);
            Assert.NotNull(requestToken);

            var uri = service.GetAuthorizationUri(requestToken);
            Process.Start(uri.ToString());

            Console.WriteLine("Press the any key when you have confirmation of your code transmission.");
            var verifier = "1234567"; // <-- Debugger breakpoint and edit with the actual verifier

            OAuthAccessToken accessToken = service.GetAccessToken(requestToken, verifier);
            AssertResultWas(service, HttpStatusCode.OK);
            Assert.IsNotNull(accessToken);
        }
开发者ID:PetroProts,项目名称:tweetsharp,代码行数:18,代码来源:TwitterServiceTests.OAuth.cs

示例3: Can_make_protected_resource_request_with_access_token

        public void Can_make_protected_resource_request_with_access_token()
        {
            var service = new TwitterService(_consumerKey, _consumerSecret);
            var request = service.GetRequestToken();

            AssertResultWas(service, HttpStatusCode.OK);
            Assert.NotNull(request);

            var uri = service.GetAuthorizationUri(request);
            Process.Start(uri.ToString());

            Console.WriteLine("Press the any key when you have confirmation of your code transmission.");
            var verifier = "1234567"; // <-- Debugger breakpoint and edit with the actual verifier

            var access = service.GetAccessToken(request, verifier);
            AssertResultWas(service, HttpStatusCode.OK);
            Assert.IsNotNull(access);

            service.AuthenticateWith(access.Token, access.TokenSecret);
            var mentions = service.ListTweetsMentioningMe(new ListTweetsMentioningMeOptions());
            Assert.IsNotNull(mentions);
            Assert.AreEqual(20, mentions.Count());
        }
开发者ID:PetroProts,项目名称:tweetsharp,代码行数:23,代码来源:TwitterServiceTests.OAuth.cs


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