public SatisfactionClient(String consumerKey, String consumerSecret, String accessKey, String accessSecret)
        {
            _consumer = new OAuthConsumer { Key = consumerKey, Secret = consumerSecret };

            _accessToken = new OAuthToken
            {
                Key = accessKey,
                Secret = accessSecret,
                TokenType = OAuthTokenType.AccessToken
            };
        }
        internal static String GenerateOAuthUrl(OAuthConsumer consumer, OAuthToken token, Dictionary<String, String> additionalFields, String baseUrl)
        {
            var oauth = new OAuthBase();
            string timestamp = oauth.GenerateTimeStamp();
            string nonce = oauth.GenerateNonce();

            string normUrl;
            string normParms;

            string url = String.Format("{0}?{1}", baseUrl, GetQueryString(additionalFields));
            var uri = new Uri(url);

            var signature = oauth.GenerateSignature(uri, consumer.Key, consumer.Secret, token.Key, token.Secret, "GET", timestamp, nonce, out normUrl, out normParms);

            return String.Format("{0}?{1}&oauth_signature={2}", normUrl, normParms, OAuthBase.UrlEncode(signature));
        }
 internal static String GetUrl(OAuthConsumer consumer, OAuthToken token, String companyName)
 {
     string url = String.Format(CompanyTopicsUrl, companyName);
     return GenerateOAuthUrl(consumer, token, new Dictionary<string, string>(), url);
 }
        public void Initialize()
        {
            if (_consumer == null)
                throw new Exception();

            using (var client = new WebClient())
            {
                string requestTokenUrl = UrlBuilder.GenerateOAuthUrl(_consumer, OAuthToken.Empty, new Dictionary<string, string>(), RequestTokenEndpoint);
                string[] requestTokenResponse = client.DownloadString(requestTokenUrl).Split(new[] { '=', '&' });

                var requestToken = new OAuthToken
                {
                    Key = requestTokenResponse[1],
                    Secret = requestTokenResponse[3],
                    TokenType = OAuthTokenType.RequestToken
                };
                Debug.WriteLine(requestToken);

                string authorizeUrl = String.Format("{0}?oauth_token={1}", UserAuthorizationEndpoint, requestToken.Key);
                Debug.WriteLine(authorizeUrl);

                string accessTokenUrl = UrlBuilder.GenerateOAuthUrl(_consumer, requestToken, new Dictionary<string, string>(), AccessTokenEndpoint);
                string[] accessTokenResponse = client.DownloadString(accessTokenUrl).Split(new[] { '=', '&' });

                var accessToken = new OAuthToken
                {
                    Key = accessTokenResponse[1],
                    Secret = accessTokenResponse[3],
                    TokenType = OAuthTokenType.AccessToken
                };
                Debug.WriteLine(accessToken);
            }
        }