本文整理汇总了C#中Twitter.GetAccessToken方法的典型用法代码示例。如果您正苦于以下问题:C# Twitter.GetAccessToken方法的具体用法?C# Twitter.GetAccessToken怎么用?C# Twitter.GetAccessToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Twitter
的用法示例。
在下文中一共展示了Twitter.GetAccessToken方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
private static void Main(string[] args)
{
var twitter = new Twitter(TokenRepository.LoadFrom("twitter.consumer.token.txt"));
var url = twitter.GetAuthorizationUrl();
Console.WriteLine(url);
Process.Start(url);
Console.Write("Bitte geben Sie die PIN aus dem Browserfenster ein: ");
var pin = Console.ReadLine();
var accessToken = twitter.GetAccessToken(pin);
Console.Write("Access key: ");
Console.WriteLine(accessToken.Key);
Console.Write("Access secret: ");
Console.WriteLine(accessToken.Secret);
TokenRepository.SaveTo("twitter.access.token.txt", accessToken);
Console.WriteLine("Token gespeichert in twitter.access.token.txt");
Console.WriteLine("Mit Enter beenden...");
Console.ReadLine();
}
示例2: TwitterLogin
public void TwitterLogin()
{
OAuthInfo acc = TwitterGetActiveAccount();
string verification = acc.AuthVerifier;
if (!string.IsNullOrEmpty(verification) && acc != null &&
!string.IsNullOrEmpty(acc.AuthToken) && !string.IsNullOrEmpty(acc.AuthSecret))
{
Twitter twitter = new Twitter(acc);
bool result = twitter.GetAccessToken(acc.AuthVerifier);
if (result)
{
MessageBox.Show("Login successful.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Login failed.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
示例3: TwitterAuthComplete
public void TwitterAuthComplete()
{
if (CheckTwitterAccounts())
{
OAuthInfo acc = Config.TwitterOAuthInfoList[Config.TwitterSelectedAccount];
if (acc != null && !string.IsNullOrEmpty(acc.AuthToken) && !string.IsNullOrEmpty(acc.AuthSecret) && !string.IsNullOrEmpty(acc.AuthVerifier))
{
Twitter twitter = new Twitter(acc);
bool result = twitter.GetAccessToken(acc.AuthVerifier);
if (result)
{
acc.AuthVerifier = string.Empty;
Config.TwitterOAuthInfoList[Config.TwitterSelectedAccount] = acc;
ucTwitterAccounts.pgSettings.SelectedObject = acc;
MessageBox.Show("Login successful.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Login failed.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}