Dear all,
I have the same problem, getting 403 error
Here's my code :
Request authentication :
CODE
protected void lbImportYahoo_Click(object sender, EventArgs e)
{
string yahooid = ConfigurationSettings.AppSettings["_app"];
string yahoosecret = ConfigurationSettings.AppSettings["_secret"];
Yahoo.YahooAuthentication auth = new Yahoo.YahooAuthentication(yahooid, yahoosecret);
string loginAddress = auth.GetUserLogOnAddress().ToString();
Response.Redirect(loginAddress);
}
After request authentication, now trying to retrieve the contacts
CODE
protected static string yahooid = ConfigurationSettings.AppSettings["_app"];
protected static string yahoosecret = ConfigurationSettings.AppSettings["_secret"];
private Yahoo.YahooAuthentication auth = new Yahoo.YahooAuthentication(yahooid, yahoosecret);
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["token"] != null && Request.QueryString["token"].Length > 0)
{
if (auth.IsValidSignedUrl(Request.Url) == true)
{
// Given token to Authentication class
auth.Token = Request.QueryString["token"];
// TODO: Save the token and its timeout date in a secure persistent store.
// Attempt to retrieve user credentials
auth.UpdateCredentials();
if (auth.IsCredentialed == true)
{
string url = "http://address.yahooapis.com/v1/searchContacts?format=xml&fields=name,email";
System.Data.DataSet dsServices;
try
{
dsServices = auth.GetAuthenticatedServiceDataSet(new System.Uri(url));
}
catch (Exception ex)
{
lblAddress.Text = "token : " + auth.Token + " ID : " + auth.ApplicationId + " cookies : " + auth.Cookies + " wssid : " + auth.WssId;
}
}
}
}
}
This is the address that I want to retrieve from
http://address.yahooapis.com/v1/searchCont...SSID=*censored*I'm able to login, but when it's processing the login, I got error in here : dsServices = auth.GetAuthenticatedServiceDataSet(new System.Uri(url));
or, to be exact, when it tried to get the response :
response = request.GetResponse() as System.Net.HttpWebResponse;
Somehow, I still got forbidden error eventhough I got all set (including the token and the cookies
Please advice