本文整理汇总了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");
}
示例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);
}
示例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());
}