コード例 #1
0
        public void GetAccessToken(string verifier)
        {
            string timestamp = DateHelpers.DateTimeToUnitTimeStamp(DateTime.UtcNow).ToString();

            SimpleConnector connector = new SimpleConnector();

            connector.SetServerName(Constants.Urls.TOKEN_ACCESS);
            connector.AddParam("oauth_token", this.OAuthToken);
            connector.AddParam("oauth_consumer_key", Settings.Key);
            connector.AddParam("oauth_nonce", Settings.Nounce);
            connector.AddParam("oauth_timestamp", timestamp);
            connector.AddParam("oauth_verifier", verifier);
            connector.AddParam("oauth_signature_method", Settings.SignatireMethod);
            connector.AddParam("oauth_signature", this.generateSignature(this.CurrentSignatureType, "POST", Constants.Urls.TOKEN_ACCESS, connector.GetParams(), Settings.SecretKey + "&" + this.OAuthTokenSecret));
            connector.OnRequestComplete += parseAccessToken;
            connector.OnRequestComplete += this.onRequestComplete;
            connector.SendPost();
        }
コード例 #2
0
        public void GetRequestToken()
        {
            string timestamp = DateHelpers.DateTimeToUnitTimeStamp(DateTime.UtcNow).ToString();

            SimpleConnector connector = new SimpleConnector();

            connector.SetServerName(Constants.Urls.TOKEN_REQUEST);
            connector.AddParam("oauth_consumer_key", Settings.Key);
            connector.AddParam("oauth_nonce", Settings.Nounce);
            connector.AddParam("oauth_timestamp", timestamp);
            connector.AddParam("oauth_signature_method", Settings.SignatireMethod);
            connector.AddParam("oauth_signature", this.generateSignature(this.CurrentSignatureType, "POST", Constants.Urls.TOKEN_REQUEST, connector.GetParams(), Settings.SecretKey + "&"));

            connector.OnRequestComplete += this.parseResponse;
            connector.OnRequestComplete += this.onRequestComplete;

            connector.SendPost();
        }