【问题标题】:Blank Auth Dialog Window in Outlook React AddinOutlook React Addin 中的空白身份验证对话框窗口
【发布时间】:2019-12-26 03:37:15
【问题描述】:

我尝试在我的 Outlook Addin React 应用程序中使用 Dialog APIoffice-js-helpers 对用户进行身份验证,并且它们都为身份验证创建了弹出窗口,但它们都是空白屏幕。两种方法都返回以下错误

未声明纯文本文档的字符编码。 该文档将在某些浏览器中呈现乱码 如果文档包含来自外部的字符,则配置 US-ASCII 范围。文件的字符编码需要是 在传输协议或文件中声明需要使用字节顺序 标记为编码签名。

起初我认为这可能是因为我的 Auth 域未在我的清单中列出并带有 AppDomain 标记,但后来我添加了它并重新安装了我的加载项,但没有成功。

这是我尝试过的两个版本:

Office.context.ui.displayDialogAsync('https://foobar.auth.us-east-1.amazoncognito.com/login?client_id=MY_CLIENT_ID&response_type=code&redirect_uri=https://localhost:3000', {height: 30, width: 20});

authenticator.endpoints.add('Cognito', {
  redirectUrl: 'https://localhost:3000',
  baseUrl:'https://foobar.auth.us-east-1.amazoncognito.com/oauth2',
  authorizeUrl: '/authorize',
  responseType: 'token',
  tokenUrl: '/token',
  state: false,
  nonce: false,
  scope: 'openid',
  extraQueryParameters:null,
  clientId: 'MY_CLIENT_ID'
});
//for the default Microsoft endpoint
authenticator
    .authenticate('Cognito')
    .then(function (token) { return console.log('good') })
    .catch(function(err)
    {
      OfficeHelpers.Utilities.log();
      console.log("CATCH ERROR")
      console.log(JSON.stringify(err))
    });

我并不特别关心我使用哪种方法,我只需要其中一种方法即可。

【问题讨论】:

    标签: reactjs amazon-cognito office-js office-addins office-js-helpers


    【解决方案1】:

    您传递给 displayDialogAsync 的 URL 应与加载项位于同一域中,在您的情况下为 localhost:3000。但是,该 URL 可以是立即重定向到登录页面的空白页面。更多信息,请参阅Auth with the Office Dialog

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-04-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-11
      相关资源
      最近更新 更多