Estou tentando fazer uma conexão com a API do live connect e obter a conexão e a lista de usuarios.
Porém não consigo testar no localhost. Tem como eu fazer esse teste no localhost?
Estou usando as seguintes linhas de código:
<!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>Client-Side JavaScript Dashboard</title>
<script src="//js.live.net/v5.0/wl.js"></script>
<script src="gather_info.js"></script>
</head>
<body>
<div id="signin">
</div>
<br />
<label id="infoLabel">
</label>
<script>
function friendFinder_onClick() {
WL.login({
scope: "wl.basic"
}).then(
function (response) {
WL.api({
path: "me/contacts",
method: "GET"
}).then(
function (response) {
var resultData = response.data;
var emailHashes = new Array;
for (i = 0; i < resultData.length; i++) {
for (j = 0; j < resultData[i].email_hashes.length; j++) {
emailHashes[emailHashes.length] = resultData[i].email_hashes[j];
}
}
var resultText = "";
for (k = 0; k < emailHashes.length; k++) {
resultText += emailHashes[k] + "\r\n";
}
document.getElementById("infoArea").setAttribute("rows", emailHashes.length);
document.getElementById("infoArea").value = resultText;
},
function (responseFailed) {
document.getElementById("infoArea").value =
"Error calling API: " + responseFailed.error.message;
}
);
},
function (responseFailed) {
document.getElementById("infoArea").innerText =
"Error signing in: " + responseFailed.error_description;
}
);
}
WL.Event.subscribe("auth.login", onLogin);
WL.init({
client_id: 'CLIENT_ID',
redirect_uri: 'https://login.live.com/oauth20_authorize.srf?client_id=CLIENT_ID&scope=wl.signin&response_type=RESPONSE_TYPE&redirect_uri=REDIRECT_URL',
scope: "wl.signin",
response_type: "token"
});
WL.ui({
name: "signin",
element: "signin"
});
function onLogin() {
document.getElementById("infoLabel").innerText = "Signed in.";
}
</script>
</body>
</html>
Lembrando que o CLIENT_ID é o mesmo do meu registro.
Será que alguém pode me ajudar?