2017-07-25 68 views
0

我试图使用hello.js init API稍后登录Microsoft Graph。下面的代码是我现在正在做的,它的工作原理。如何将两个`hello.init`合并成一个?

repo

但是,有没有办法将这两个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 
}); 
+0

您是否尝试过这个建议? https://github.com/MrSwitch/hello.js/issues/470 –

+0

嗯,只是尝试过,这种方式不提供应用程序ID,它也会返回错误'提供的网络无法识别'当使用'aad '。 –

回答

0

我从hello.js安德鲁·多德森对GitHub创建者的答案。

hello.init ({msft:appid})是短期的hello.init ({msft:{id:appid}}) 所以你只需要在你的定义中定义一个id道具,它都会 工作。 Fyi这是没有记录的,将来可能会改变。

所以在我的情况下,解决的办法是

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 } 
);