public OAuthHeaderGenerator(Uri requestUri, string requestMethod, AccessCredentials tokens)
 {
     Parameters = new Dictionary<string, object>();
     RequestUri = requestUri;
     RequestMethod = requestMethod;
     Tokens = tokens;
 }
        public AccessCredentials Execute()
        {
            UriBuilder.BaseUrl = "https://api.twitter.com/oauth/access_token";
            Parameters.Add("oauth_token", RequestTokens.Token);
            if (string.IsNullOrEmpty(RequestTokens.Verifier))
            {
                Parameters.Add("oauth_verifier", RequestTokens.Verifier);
            }
            Sign();
            string responseString = GetResponse();
            AccessCredentials response = new AccessCredentials();
            response.AccessToken = Regex.Match(responseString, @"oauth_token=([^&]+)").Groups[1].Value;
            response.AccessTokenSecret = Regex.Match(responseString, @"oauth_token_secret=([^&]+)").Groups[1].Value;

            return response;
        }
示例#3
0
 public TwitterRequest()
 {
     Tokens = new AccessCredentials();
     Parameters = new Dictionary<string, string>();
 }