I am stuck on how to read url parameters/token from redirected page url in Outlook web-addin. I am using DialogAPI to pop up my azure app sign-in/consent page and then trying to read tokens from redirected page.
I can see that token are passed but I couldn't figure out how to read token from url?
function GetToken(url)
{
_dlg = Office.context.ui.displayDialogAsync(url, { height: 40, width: 40 }, function (result) {
_dlg = result.value;
_dlg.addEventHandler(Office.EventType.DialogMessageReceived, processMessage);
Office.context.ui.messageParent(somevalue);
});
}
Besides that the processMessage call back never gets triggered, wondering why?
Guys any feedback would be helpful.
Thanks
Office.context.ui.displayDialogAsync must be called from the host page and Office.context.ui.messageParent must be called from the Dialog box.
This should be on the host page :
var dialog;
Office.context.ui.displayDialogAsync(url,
{height: 40, width: 40}, function (result) {
dialog = result.value;
dialog.addEventHandler(Office.EventType.DialogMessageReceived,
function(somevalue){
console.log(somevalue);});
});
This should be on the Dialog Box :
Office.initialize = function (reason) {
$(document).ready(function () {
Office.context.ui.messageParent(somevalue);
}
}
in your manifest, must have all the domains being accessed with "https".
Please visit here for more info.