Ferhat KARATAS


I successfully get required token, but i could not process it with httprequest. The error is "unauthorized"

what's wrong

code i used :

--------------------

TicketAcquirer t = new TicketAcquirer();

string token = t.GetTicket(); // get ticket successfully (t=xxx=)

String uri = "https://cumulus.services.live.com/aaa@hotmail.com/LiveContacts/Contacts";

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);

request.Method = "GET";

request.Headers.Add("Authorization", "WLD1.0 t=" + token); // is it right

try

{

HttpWebResponse response = (HttpWebResponse)request.GetResponse(); // error occurred in this row

//request succeeded, process response

//The response body is XML: read the stream into an XML Document.

XmlDocument contacts = new XmlDocument();

contacts.LoadXml(new StreamReader(response.GetResponseStream()).ReadToEnd());

// Do something with the returned XML data...

response.Close();

}

catch (WebException ex)

{

//request failed, handle error

}




Re: How to get contact information with RPS

Federico Raggi - MSFT


I asked YuanYuan, one of our developers to go over your code and he pointed out that the token content should surrounded by quotes. This is how the authorizatuion header should look like:

.

Authorization: WLID1.0 t="<your token here>"

Try adding "\"" before and after your token. I can't test it right now, but I think this should work:

request.Headers.Add("Authorization", "WLD1.0 t=" + "\"" + token + "\"");

Let me know if this solved your problem!







Re: How to get contact information with RPS

Ferhat KARATAS

No, not solved. The error is still "unauthorized 401"

code i used :
TicketAcquirer t = new TicketAcquirer();
string token = t.GetTicket();

String uri = "https://cumulus.services.live.com/fkaratas@hotmail.com/LiveContacts/Contacts";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "GET";
//request.Headers.Add("Authorization", "WLD1.0 t=" + token);
request.Headers.Add("Authorization", "WLD1.0 t=" + "\"" + token + "\"");

try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
//request succeeded, process response


PS : After your changes my header info switch from

Authorization: WLD1.0 t= t=EwD..=

to

Authorization: WLD1.0 t="t=EwD..="


Anyway, is there a way like ticket credential (provide username and password) sample code I want my users log in my page with uname/pass credential and get his/her contact list.






Re: How to get contact information with RPS

Federico Raggi - MSFT

It turns out that I had a typo in my code. It should be WLID1.0 instead of WLD1.0. Try that and let me know if that solves your problem.

We have sample code on the Windows Live Data SDK. Check this article: http://msdn2.microsoft.com/en-us/library/bb447721.aspx.






Re: How to get contact information with RPS

Ferhat KARATAS

Yess, it works !

Thank you very very much.

I switch from DomainAuthToken to RPS, may these errors occurred because of this.






Re: How to get contact information with RPS

Federico Raggi - MSFT

Great!

Please let me know if you have any feedback or suggestions to improve Windows Live Data and make it easier to use and more valuable for developers.






Re: How to get contact information with RPS

Hisham_85






Re: How to get contact information with RPS

Hisham_85