Exemple #1
0
        public string Sign(ParamUrl requestUrl, OAuthToken authToken)
        {
            string timestamp = timeStamp();
            string nonce = random.Next(0, int.MaxValue).ToString();
            string token = (authToken == null)? String.Empty : authToken.Token;
            string secret = (authToken == null)? String.Empty : authToken.Secret;
            string signature = string.Format("{0}&{1}", consumerSecret, secret);

            requestUrl.Add("oauth_consumer_key", consumerKey);
            requestUrl.Add("oauth_nonce", nonce);
            requestUrl.Add("oauth_timestamp", timestamp);
            requestUrl.Add("oauth_signature_method", "PLAINTEXT");
            requestUrl.Add("oauth_version", "1.0");
            requestUrl.Add("oauth_signature", Uri.EscapeDataString(signature));
            if (!String.IsNullOrEmpty(token)) requestUrl.Add("oauth_token", token);

            return requestUrl.ToString();
        }
Exemple #2
0
 private async Task retrieveRequestToken()
 {
     if (_oAuth == null)
         throw new ProviderNotSetupException("Please provide app key and secret first.");
     var url = _oAuth.Sign(new ParamUrl(DropboxConfig.RequestTokenUrl), null);
     var response = await Http.ResponseToAsync(url).ConfigureAwait(false);
     _requestToken = tokenFromResponse(response);
 }