Created
January 27, 2020 09:18
-
-
Save eirikb/2519feacd278ada721e5141a37e166b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isOutlookNative = Office.context.mailbox && Office.context.mailbox.diagnostics.hostName === 'Outlook'; | |
if (isOutlookNative) { | |
msal.openPopup = () => { | |
const dummy = { | |
close() { | |
}, | |
location: { | |
assign(url) { | |
Office.context.ui.displayDialogAsync(url, { width: 25 }, res => { | |
dummy.close = res.value.close; | |
res.value.addEventHandler(Office.EventType.DialogMessageReceived, ({ message }) => | |
dummy.location.href = dummy.location.hash = message | |
); | |
}); | |
} | |
} | |
}; | |
return dummy; | |
}; | |
const { hash } = window.location; | |
if (msal.isCallback(hash)) { | |
Office.context.ui.messageParent(hash); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment