"Object doesn't support property or method 'messageParent'" After login redirect in Office js -
i trying dialog open in order enter login credentials, after being redirected login authority no longer able message parent of dialog window authorization codes or tokens. if not redirect away page, can message parent, otherwise error in title. how can message parent (in case task pane) window information dialog?
below code have open , handle dialog window:
var dialog; function authenticate() { hideall(); office.context.ui.displaydialogasync('mydomain/login', { height: 50, width: 25 }, dialogcallback); } function dialogcallback(asyncresult) { if (asyncresult.status === 'failed') { console.log(asyncresult.error.message); } else { dialog = asyncresult.value; dialog.addeventhandler(microsoft.office.webextension.eventtype. dialogmessagereceived, messagehandler); dialog.addeventhandler(microsoft.office.webextension.eventtype. dialogeventreceived, eventhandler); } } function messagehandler(arg) { showall(); console.log(arg); dialog.close(); } function eventhandler(arg) { showall(); console.log(arg); }
here code handles login screen:
office.initialize = function (reason) { $(document) .ready(function () { var code = $('#code').text(); if (code !== '') { console.log(code); office.context.ui.messageparent(code); } else { console.log('no code received auth server'); } }); };
the issue solved making sure landing on page on domain first. directing controller redirecting domain, hadn't yet returned page.
Comments
Post a Comment