0

I am using this example to successfuly make a login connection on windows live platform:
http://code.msdn.microsoft.com/messengerconnect (the oauth handler callback one)

I receive a token and a user id from their api, but I can't seem to understand how to fetch the user profile from these info.
Does anyone know how to do this?
There are examples in MS website, but they are all C# or javascript ones and I have to do it in PHP.

After retrieving the token and the cid I tried this, but returns me an error:

$url_string = 'http://apis.live.net/V4.1/cid-'.$user->getId().'/Profiles/';
echo("<br/>\n".$url_string);
$curl_session = curl_init($url_string);

// build HTTP header with authorization code
$curl_options = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array(
  'Authorization: WRAP access_token=AuthToken="'.urlencode($_REQUEST['stoken']).'"',
  'Accept: application/json'
  )
);

// setup options for curl transfer
curl_setopt_array($curl_session, $curl_options);

// execute session and get response
$curl_response = curl_exec($curl_session);

print $curl_response;

curl_close($curl_session);

The error is this:
{"Title":"ErrorResource","Code":1062,"Message":"Request does not contain a valid PUID."}

can you guys help me retrieving the user info?

EDIT:
solved the problem by removing the =AuthToken from the authorization and it worked!

Thanks,
Joe

Jonathan
  • 4,724
  • 7
  • 45
  • 65
  • I know this is an old thread, but no matter what I try I keep on getting the invalid PUID message. Could you paste the full subset of your code? – PaulM Oct 25 '11 at 14:20

1 Answers1

0

Yes!

made it work after hours trying lots of differents samples from ms ¬¬

the problem was the Authorization: WRAP access_token=AuthToken=

just removed the AuthToken= and it worked!

so its now like this:
'Authorization: WRAP access_token="'.$wrapper->getReturnedParameter('wrap_access_token').'"'

Jonathan
  • 4,724
  • 7
  • 45
  • 65
  • Hello Jonathan, I have tryed the same example but i always catch an error when i try Access Token Request. Can you post me a runing example. Thanks –  Jan 19 '11 at 03:32
  • its the same example code in the php sdk, the only change you have to do for it to work is remove the extra AuthToken= in the header of the message – Jonathan Feb 06 '11 at 04:34