private string RequestToken()
        {
            string outUrl;
            List <QueryParameter> requestParameters;

            string nonce     = GenerateNonce();
            string timeStamp = GenerateTimeStamp();

            string sig = GenerateSignature(RequestTokenEndpoint,
                                           String.Empty,
                                           String.Empty,
                                           CallbackUri.OriginalString,
                                           String.Empty,
                                           RequestTokenMethod.ToString(),
                                           timeStamp,
                                           nonce,
                                           out outUrl,
                                           out requestParameters);

            var headerParameters = new List <QueryParameter>
            {
                new QueryParameter(OAuthCallbackKey, CallbackUri.OriginalString),
                new QueryParameter(OAuthConsumerKeyKey, APIKey),
                new QueryParameter(OAuthNonceKey, nonce),
                new QueryParameter(OAuthSignatureKey, sig),
                new QueryParameter(OAuthSignatureMethodKey, HMACSHA1SignatureType),
                new QueryParameter(OAuthTimestampKey, timeStamp),
                new QueryParameter(OAuthVersionKey, OAuthVersion)
            };

            string ret = ExecuteWebRequest(RequestTokenMethod, new Uri(outUrl), String.Empty, headerParameters.ToAuthorizationString());

            return(ret);
        }
Beispiel #2
0
        private string RequestToken()
        {
            string outUrl = String.Empty;
            List <QueryParameter> requestParameters;
            string ret = String.Empty;

            string nonce     = GenerateNonce();
            string timeStamp = GenerateTimeStamp();

            string sig = GenerateSignature(RequestTokenEndpoint,
                                           String.Empty,
                                           String.Empty,
                                           CallbackUri.OriginalString,
                                           String.Empty,
                                           RequestTokenMethod.ToString(),
                                           timeStamp,
                                           nonce,
                                           out outUrl,
                                           out requestParameters);

            string postData = requestParameters.ToNormalizedString() + "&" + OAuthSignatureKey + "=" + UrlEncode(sig);

            ret = ExecuteWebRequest(RequestTokenMethod, new Uri(outUrl), postData, String.Empty);

            return(ret);
        }