...

View Full Version : Window slive developer API - not showing user info when logged in



jarv
08-21-2011, 03:48 PM
hi,

I am following the tutorial on Windows Live App API from here: http://isdk.dev.live.com/ISDK.aspx?category=Core+Concepts&index=0 and I have added my Client ID got a login system working and allowing information to be passed through but I cannot display the user that's currently logged in, here is my page:


link:
http://www.trialsevolution.co.uk/app/

code:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Greeting the User Test page</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="https://js.live.net/v5.0/wl.js" type="text/javascript"></script>
<script type="text/javascript">
var APPLICATION_CLIENT_ID = "000000004805DA23",
REDIRECT_URL = "http://www.trialsevolution.co.uk/app/home.html";
WL.Event.subscribe("auth.login", onLogin);
WL.init({
client_id: 00000000000000,
redirect_uri: "http://www.trialsevolution.co.uk/app/home.html",
response_type: "token"
});
WL.ui({
name: "signin",
element: "signInButton"
});

function greetUser(session) {
var strGreeting = "welcome";
WL.api(
{
path: "me",
method: "GET"
},
function (response) {
if (!response.error) {
strGreeting = "Hi, " + response.first_name + "!"
document.getElementById("greeting").innerHTML = strGreeting;
}
});
}
function setMeImage(token) {
var imgHolder = document.getElementById("meimg"),
imgTagString = "";

if (token != null) {
var url = "https://apis.live.net/v5.0/me/picture?oauth_token=" + escape(token);
imgTagString = "<img src='" + url + "' />";
}
imgHolder.innerHTML = imgTagString;
}
function onLogin() {
var session = WL.getSession();
if (session){
greetUser(session);
setMeImage(session.access_token);
}
}
</script>
</head>
<body>
<p>Sign in to display a welcome greeting.</p>
<div id="meimg"></div>
<div id="greeting"></div>
<div id="signInButton"></div>

</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum