开发者

Retrieving user profile on messenger(windows live) connect sdk within php

开发者 https://www.devze.com 2023-02-01 06:15 出处:网络
I am using this example to successfuly make a login connection on windows live platform: http://code.msdn.microsoft.com/messengerconnect

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,

开发者_StackOverflow中文版 Joe


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').'"'

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号