无法读取 fallbackauthhelper.js 中未定义的属性“toString”以用于 SSO 字插件

问题描述

我为 Word 创建了一个单点登录加载项。并遵循链接 https://docs.microsoft.com/en-us/office/dev/add-ins/quickstarts/sso-quickstart#configure-sso 中提到的相同步骤 但是当我运行插件时,我在 sso.showMessage(JSON.stringify(messageFromDialog.error.toString())) 部分中得到一个错误。 每次我点击用户信息按钮时,都会出错这一堆代码和信息:

async function processMessage(arg) {
  console.log("Message received in processMessage: " + JSON.stringify(arg));
  let messageFromDialog = JSON.parse(arg.message);

  if (messageFromDialog.status === "success") {
    // We Now have a valid access token.
    loginDialog.close();
    const response = await sso.makeGraphApiCall(messageFromDialog.result);
    documentHelper.writeDataToOfficeDocument(response);
  } else {
    // Something went wrong with authentication or the authorization of the web application.
    loginDialog.close();
    sso.showMessage(JSON.stringify(messageFromDialog.error.toString()));
  }
}

// 使用 Office 对话框 API 打开一个弹出窗口并显示身份提供者的登录页面

function showLoginPopup(url) {
  var fullUrl = location.protocol + "//" + location.hostname + (location.port ? ":" + location.port : "") + url;

  // height and width are percentages of the size of the parent Office application,e.g.,PowerPoint,Excel,Word,etc.
  Office.context.ui.displayDialogAsync(fullUrl,{ height: 60,width: 30 },function (result) {
    console.log("Dialog has initialized. Wiring up events");
    loginDialog = result.value;
    loginDialog.addEventHandler(Office.EventType.DialogMessageReceived,processMessage);
  });
}

代码的两部分都属于错误消息以及注释。我想了解这些错误的含义以及如何解决它。非常感谢任何帮助。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)