如何将两个 `hello.init` 合二为一?
How to combine two `hello.init` into one?
我正在尝试使用 hello.js init API 稍后登录 Microsoft Graph。下面的代码是我现在正在做的并且有效。
但是,有没有办法将这两个hello.init
合二为一呢?谢谢
hello.init({
msft: {
oauth: {
version: 2,
auth: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'
},
scope_delim: ' ',
form: false
}
});
hello.init({
msft: myAppId
}, {
redirect_uri: window.location.href
});
我在 GitHub 上从 hello.js Andrew Dodson 的创建者那里得到了答案。
hello.init ({msft:appid})
is short for hello.init ({msft:{id:appid}})
so you just need to define an id prop on your definition and it'll all
work. Fyi this is undocumented and may change in the future.
所以就我而言,解决方案是
hello.init({
msft: {
id: myAppId,
oauth: {
version: 2,
auth: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'
},
scope_delim: ' ',
form: false
},
},
{ redirect_uri: window.location.href }
);
我正在尝试使用 hello.js init API 稍后登录 Microsoft Graph。下面的代码是我现在正在做的并且有效。
但是,有没有办法将这两个hello.init
合二为一呢?谢谢
hello.init({
msft: {
oauth: {
version: 2,
auth: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'
},
scope_delim: ' ',
form: false
}
});
hello.init({
msft: myAppId
}, {
redirect_uri: window.location.href
});
我在 GitHub 上从 hello.js Andrew Dodson 的创建者那里得到了答案。
hello.init ({msft:appid})
is short forhello.init ({msft:{id:appid}})
so you just need to define an id prop on your definition and it'll all work. Fyi this is undocumented and may change in the future.
所以就我而言,解决方案是
hello.init({
msft: {
id: myAppId,
oauth: {
version: 2,
auth: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'
},
scope_delim: ' ',
form: false
},
},
{ redirect_uri: window.location.href }
);