0

.Net Code to work with Contacts API

Hi ,


Can anyone please post some code snippet to get the request token using OAUth.Getting Unauthorized error when using the below code.
Previously My Application was able to fetch the contact list using BBAuth.

OAuthBase oAuth = new OAuthBase();
string nonce = oAuth.GenerateNonce();
string timeStamp = oAuth.GenerateTimeStamp();
Uri uri = new Uri("https://api.login.yahoo.com/oauth/v2/get_request_token");

StringBuilder sb = new StringBuilder(uri.ToString());
sb.AppendFormat("?oauth_nonce={0}&", nonce);
sb.AppendFormat("oauth_timestamp={0}&", timeStamp);
sb.AppendFormat("oauth_consumer_key={0}&", consumerKey);
sb.AppendFormat("oauth_signature_method={0}&", "HMAC-SHA1");
sb.AppendFormat("oauth_signature={0}&", consumerSecret);
sb.AppendFormat("oauth_version={0}&", "1.0");
sb.AppendFormat("xoauth_lang_pref={0}&", "en-us");
sb.AppendFormat("oauth_callback={0}", "http://www.115.113.210.181.com/OAUTHYahooSample/Default2.aspx/callback");
//sb.AppendFormat("/contacts", "");

HttpWebRequest request = WebRequest.Create(sb.ToString()) as HttpWebRequest;
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
StreamReader YahooContactsList = new StreamReader(response.GetResponseStream());

Any help appreciated.Waiting for reply.

by
  • US
  • Feb 10, 2010
0 Replies

Recent Posts

in Contacts