2017-07-25 43 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 } 
);