我正在尝试使用他们的JavaScript API实现windows live
登录。我将this文档作为示例并使用以下代码:
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;
}
}
上面的代码正在返回id
,name
和其他字段,但我还希望获得用户的email
和profile picture url
字段,例如google+
和email
字段1}} API,在scope
中提及email
。我已完成WL.init documentation,但未提及profile picture url
和scope
SQL> conn / as sysdba
Connected.
SQL> create table test (id number(10), v_char varchar2(10));
Table created.
SQL> insert into test values(11111111111,'darshan');
insert into test values(11111111111,'darshan')
*
ERROR at line 1:
ORA-01438: value larger than specified precision allows for this column
SQL> insert into test values(11111,'darshandarsh');
insert into test values(11111,'darshandarsh')
*
ERROR at line 1:
ORA-12899: value too large for column "SYS"."TEST"."V_CHAR" (actual: 12,
maximum: 10)
SQL> insert into test values(111,'Darshan');
1 row created.
SQL>
值。有没有办法获得这两个领域?
答案 0 :(得分:0)
关于范围看看 https://msdn.microsoft.com/en-us/library/hh243646.aspx#core
你需要" wl.emails"对于用户的电子邮件'我'。对于用户的图片,您不需要特殊范围
var scope = {scope:["wl.signin", "wl.basic", "wl.emails"]};
WL.login(scope, windowsLiveLoginCallback);
...
WL.api({
path: "me",
method: "GET"
}).then(
function (response){
var email = "";
if(response.emails.preferred){
email = response.emails.preferred;
}
else if(response.emails.account){
email = response.emails.account;
}
WL.api({
path: "me/picture",
method: "GET"
}).then(
function(pictureResponse){
// pictureResponse.location
},
function (responseFailed){
console.log('WL.api(me) error: ', responseFailed);
}
);
},
function (responseFailed){
console.log('WL.api(me) error: ', responseFailed);
}
);