office-js - Office Dialog API messageParent 在 Word 的 Edge 中不起作用
问题描述
如果我不复制 _host_Info,我会在 IE 和 Edge 的对话框弹出窗口中收到“警告 office.js 已在 office 客户端之外加载”。
我正在使用中间人服务身份验证流程。它在 Firefox、Chrome 和 Word 桌面客户端上运行良好,即使没有 _host_Info。
当我复制 _host_Info 时,对话框会在最后一次重定向回插件时自动关闭。
脚步:
- 触发 Office.context.ui.displayDialogAsync,带有查询 redirectb64 的插件位置,其中包含指向 mvc 外部登录的 url,并将 uri 重定向回插件。
- 插件再次打开检查redirectb64是否存在并将其解码回url
- 从窗口位置,我们将主机信息复制到重定向 url
- 重定向到挑战登录提供程序的 mvc 应用程序,然后返回到 mvc 应用程序进行登录,并在重定向回带有访问令牌和其他查询参数的插件之后。
从对话框事件处理程序中,我得到对话框关闭错误。
代码:
/* Render application after Office initializes */
Office.initialize = async () => {
let redirectUrl:string = window.atob(UrlHelper.getUrlParameter("redirectb64"));
if(redirectUrl !== "") {
console.log("DialogUrl",window.location);
console.log("Redirectb64 (atob)",redirectUrl);
//Must copy over this to the redirectUri;
let hostInfo:string = encodeURIComponent("&_host_Info=" + UrlHelper.getUrlParameter("_host_Info"));
redirectUrl = StringHelper.insert(redirectUrl.indexOf("&state="),redirectUrl,hostInfo);
console.log("Redirectb64 (atob) with hostInfo",redirectUrl);
window.location.href = redirectUrl;
return;
}
var response:AxiosResponse = await axios.get("assets/appconfig.json");
console.log("config loaded.", response.data);
AuthHelper.SetAccessToken();
//console.log("AuthHelper.SetAccessToken", typeof AuthHelper.SetAccessToken);
const myLanguage: string = Office.context.displayLanguage;
render(App,myLanguage, true, response.data);
};
在 login.microsoft.com 回调到 mvc 应用程序之后,对话 api 似乎丢失了对话的轨迹。为什么?
解决方案
推荐阅读
- mongodb - 为什么我的磁盘大小减小了,而没有使用 storageSize 的可用空间?ongodb
- python - 如何将 Web 元素从 Python selenium 传递到 Java?
- java - 在 WebView 上为 API 26 设置代理
- django - Django 与 python 脚本的集成
- python - 在生成器函数中使用 return
- javascript - Javacript MediaDevices.getUserMedia() 不适用于 Android 11
- arrays - C函数将argv内容检索到字符串
- flutter - 从 main.dart 调用另一个 dart 文件中的 dart 方法
- parsing - 使用 Pest.rs,我如何指定要锚定和整行的评论?
- vb.net - 获取 System.Exception:'不正确的功能。(HRESULT 例外:0x80070001)' 在 VB 中使用 MIDI