public static OAuthCredentials PerformOAuth(string consumerKey, string consumerSecret) { OAuthConfig oauthConfig = new OAuthConfig("console"); oauthConfig.OauthVersion = "1.0"; oauthConfig.OauthSignatureMethod = "HMAC-SHA1"; oauthConfig.ConsumerKey = consumerKey; oauthConfig.ConsumerSecret = consumerSecret; oauthConfig.RequestTokenUrl = "https://api.twitter.com/oauth/request_token"; oauthConfig.AccessTokenUrl = "https://api.twitter.com/oauth/access_token"; oauthConfig.UserAuthorizationUrl = "https://api.twitter.com/oauth/authorize"; OAuthConsumer oauthConsumer = new OAuthConsumer(oauthConfig, "console"); oauthConsumer.getRequestToken(); VerificationInput input = new VerificationInput(); input.ShowDialog(); string code = input.GetCode(); oauthConsumer.getAccessToken(code); OAuthCredentials rv = new OAuthCredentials(); rv.Token = oauthConfig.OauthToken; rv.Secret = oauthConfig.OauthTokenSecret; return rv; }
public CTwitter() { OAuthCredentials accessToken = new OAuthCredentials(); accessToken.Token = uiToken; accessToken.Secret = uiTokenSecret; if (accessToken.Token.Length > 0 && accessToken.Secret.Length > 0) { twttrAccessToken = accessToken; } }
public void SetPluginVariable(string variable, string value) { if (variable == "Access Token") { uiToken = value; } else if (variable == "Access Token Secret") { uiTokenSecret = value; } if (uiToken.Length > 0 && uiTokenSecret.Length > 0) { OAuthCredentials accessToken = new OAuthCredentials(); accessToken.Token = uiToken; accessToken.Secret = uiTokenSecret; twttrAccessToken = accessToken; } }