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

谁说我不能喝 提交于 2020-01-03 05:21:07

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/4526808/retrieving-user-profile-on-messengerwindows-live-connect-sdk-within-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!