Office js OfficeJs:Outlook加载项:对话框API';Messages父对象不使用OWA

Office js OfficeJs:Outlook加载项:对话框API';Messages父对象不使用OWA,office-js,outlook-web-addins,outlook-web-app,Office Js,Outlook Web Addins,Outlook Web App,背景: 我有一个outlook加载项,它基本上打开了一个登录对话框,打开了我网站上托管的加载项页面。从这里,用户被重定向到auth0,从那里他被重定向到login.live.com并发布auth。我在我的网站上再次收到一个代码或错误返回到另一个页面 现在,outlook胖客户端中的一切都正常工作。当我手动关闭对话框时,我在parent中得到了正确的错误代码 问题: 在我的网站上使用OWA和托管加载项代码时,控件不会从对话框返回到零件 我已经在“AppDomains”中添加了用户可以访问的所有UR

背景: 我有一个outlook加载项,它基本上打开了一个登录对话框,打开了我网站上托管的加载项页面。从这里,用户被重定向到auth0,从那里他被重定向到login.live.com并发布auth。我在我的网站上再次收到一个代码或错误返回到另一个页面

现在,outlook胖客户端中的一切都正常工作。当我手动关闭对话框时,我在parent中得到了正确的错误代码

问题: 在我的网站上使用OWA和托管加载项代码时,控件不会从对话框返回到零件

我已经在“AppDomains”中添加了用户可以访问的所有URL。并已确认父窗口和子窗口都位于同一域(和子域)上

代码

manifest.xml

<AppDomains>
<AppDomain>https://auth0url.auth0.com</AppDomain>
<AppDomain>https://localhost</AppDomain>
<AppDomain>https://login.live.com</AppDomain>
<AppDomain>https://login.microsoftonline.com</AppDomain>    
<AppDomain>https://my.website.com</AppDomain>
popupRedirect.js(仅托管在mywebsite上(与父窗口相同)此文件触发返回父窗口的json字符串)

预期结果:

“messageParent”应该触发index.js的“handleToken”中编写的代码

实际结果(可能相关,也可能无关)

handleToken
中写入的代码不会被触发

请注意:
displayinframe:true
不起作用,因为login.live.com不允许使用iFrame

使用的测试环境:

谷歌Chrome 71.0.3578.98(官方版本)(64位)(队列:稳定) 修订版15234034d19b85dcd9a03b164ae89d04145d8368参考/分支机构负责人/3578{897} 操作系统Windows 10 JavaScript V8 7.1.302.31
Flash 32.0.0.101

我们的问题终于解决了,但我不知道为什么这会成为一个问题。这可能是特定于我们的设置,但无论如何,它是:

我们使用了托管在auth0url.auth0.com域上的auth0。在对话框中,控件从my.website.com传递到auth0url.auth0.com,然后通过MS登录屏幕返回到my.website.com,同时我们在AppDomains中指定了此域。出于某种原因,office lib未能认识到这一点。抱怨

appsfofice.micros…16.01.debug.js:8202未能在“DOMWindow”上执行“postMessage”:提供的目标源('auth0url.auth0.com')与收件人窗口的源('s)不匹配https://my.website.com)

那么是什么变化解决了这个问题?

Auth0还支持自定义域,而不是自定义域,这意味着当我们从auth0url.Auth0.com更改为myauth0.mywebsite.com时(当然,我们将其添加到AppDomains中),加载项可以执行“postMessage”

<!-- Load the Office JavaScript APIs -->
<script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/Office.js" type="text/javascript"></script>
<script src="index.js"></script>
// height and width are percentages of the size of the screen.
Office.context.ui.displayDialogAsync(fullUrl, {height: 45, width: 55, displayInIframe: false},
      function (asyncResult) {
            console.log(asyncResult);
            if (asyncResult.status === "failed") {

                //Error code 12009 means "user chose to ignore the dialog box"
                if (asyncResult.error.code === 12009) {
                  // Handle failure    
                } else {
                  // Do something else     
                }
            } else {
                dialog = asyncResult.value;
                dialog.addEventHandler(Office.EventType.DialogMessageReceived, handleToken);
                dialog.addEventHandler(Office.EventType.DialogEventReceived, dialogClosing);

       }
    });
    Office.initialize = function() {
        $(document).ready(function () {

            // Some Code before this and after this not relevent to issue
            var messageObject = {outcome: "something"};
            // Tell the task pane about the outcome.
            Office.context.ui.messageParent(jsonMessage);

      ...
        });
    });
appsforoffice.micros…16.01.debug.js:8202 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('auth0url.auth0.com') does not match the recipient window's origin ('https://my.website.com').