Hi,
I am trying to make a request using OAuth and get the request token
but getting the time out error from my code while calling the
request.GetResponse(). Here is the code snippet. Your help will be
really appreciated...
string consumerKey = "www.example.com";
string consumerSecret = "676fg4w5tf5445/FqLfd34ChKI";
Uri uri = new Uri("https://www.google.com/accounts/
OAuthGetRequestToken");
String OutParam;
String NormalUrl;
OAuthBase oAuth = new OAuthBase();
string nonce = oAuth.GenerateNonce();
string timeStamp = oAuth.GenerateTimeStamp();
string sig = oAuth.GenerateSignature(uri, consumerKey,
consumerSecret, string.Empty, string.Empty, "GET", timeStamp, nonce,
OAuthBase.SignatureTypes.HMACSHA1, out NormalUrl, out OutParam);
sig = HttpUtility.UrlEncode(sig);
StringBuilder sb = new StringBuilder(uri.ToString());
sb.AppendFormat("?oauth_consumer_key={0}&", consumerKey);
sb.AppendFormat("oauth_nonce={0}&", nonce);
sb.AppendFormat("scope={0}&", "http://www.google.com/m8/
feeds");
sb.AppendFormat("oauth_signature={0}&", sig);
sb.AppendFormat("oauth_signature_method={0}&", "HMAC-
SHA1");
sb.AppendFormat("oauth_timestamp={0}&", timeStamp);
sb.AppendFormat("oauth_version={0}", "1.0");
HttpWebRequest request = (HttpWebRequest)WebRequest.Create
(sb.ToString());
request.Method = "GET";
request.ContentType = "application/x-www-form-urlencoded";
request.Headers.Add(HttpRequestHeader.Authorization,
"OAuth");
//Here I am getting the time out error.
//
HttpWebResponse response = (HttpWebResponse)
request.GetResponse();
//
Stream dataStream1 = response.GetResponseStream();
Please let me know if I am doing something wrong or if there is any
other way to do this.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---