<!DOCTYPE html>
<html>
<head>
<title>Windows Live Test</title>
<style>
<!--
.Name
{
font-family: Segoe UI, Verdana, Tahoma, Helvetica, Arial, sans-serif;
font-weight: bold;
}
-->
</style>
<script type='text/javascript'
src='http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.js'></script>
</head>
<body>
<h1>Windows Live Test</h1>
<div>
<div id="signin"></div>
<div id="meName" class="Name"></div>
<div id="meImg"></div>
</div>
<script src="//js.live.net/v5.0/wl.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
WL.Event.subscribe("auth.login", function () {
var session = WL.getSession();
if (session.error)
alert("Error:" + session.error);
else {
var token = session != null ? session.access_token : null;
if (token != null) {
var url =
"https://apis.live.net/v5.0/me/picture?access_token=" + escape(token);
$("#meImg").html("<img src='" + url + "' />");
WL.api({ path: "me", method: "get" }, function (response) {
if (!response.error) {
$("#meName").html(
response.first_name + " " + response.last_name);
}
});
}
}
});
WL.Event.subscribe("auth.logout", function () {
$("#meImg,#meName").html("");
});
WL.init({
client_id: "0000000048076EE5",
redirect_uri: "http://www.darkthread.net/AspNet4/LiveSDK/callback.aspx",
scope: ["wl.signin", "wl.basic", "wl.offline_access"],
response_type: "code"
});
WL.ui({
name: "signin",
element: "signin"
});
});
</script>
</body>
</html>