I am trying to implement windows live
login using their javascript API. I am referring to this documentation as an example and using the following code:
WL.Event.subscribe("auth.login", onLogin);
WL.init({
client_id: 'my client id',
redirect_uri: 'redirect uri',
scope: ["wl.signin", "wl.basic"],
response_type: "token"
});
WL.ui({
name: "signin",
element: "signin"
});
function onLogin(session) {
if (!session.error) {
WL.api({
path: "me",
method: "GET"
}).then(
function (response) {
console.log(response);
document.getElementById("info").innerText =
"Hello, " + response.first_name + " " + response.last_name + "!";
},
function (responseFailed) {
document.getElementById("info").innerText =
"Error calling API: " + responseFailed.error.message;
}
);
}
else {
document.getElementById("info").innerText =
"Error signing in: " + session.error_description;
}
}
The above code is returning id
, name
and other fields but I also want to get user's email
and profile picture url
fields like how it is returned in the google+
API by mentioning email
in the scope
. I have gone through WL.init documentation and there is no mention of email
and profile picture url
scope
values. Any way to get these two fields?
Regarding scopes have a look at https://msdn.microsoft.com/en-us/library/hh243646.aspx#core
You need "wl.emails" for the emails of the user 'me'. For the user's picture you do not need special scope
...