Outlook React加载项中的空白Auth对话框窗口 [英] Blank Auth Dialog Window in Outlook React Addin

查看:429
本文介绍了Outlook React加载项中的空白Auth对话框窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 office-js-helpers 在我的Outlook Addin React应用中对用户进行身份验证,他们两个都为auth创建弹出窗口,但它们都是空白屏幕.两种方法都返回以下错误

I have tried using Dialog API and office-js-helpers for authenticating users in my Outlook Addin React app and both of them create pop-ups for auth but they are both blank screens. Both methods return the following error

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

The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature.

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

At first I thought this may be because my Auth domain was not listed in my manifest with an AppDomain tag, but I have since added it and reinstalled my add-in with no success.

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

Here are the two versions I have tried:

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))
    });

我并不特别在意使用哪种方法,我只需要其中一种即可使用.

I don't particularly care which method I use, I just need one of them to work.

推荐答案

您传递给displayDialogAsync的URL应与加载项位于同一域中,在本例中为localhost:3000.但是,该URL可以是空白页面,可以立即重定向到登录页面.有关更多信息,请参见使用Office对话框进行身份验证.

The URL that you pass to displayDialogAsync should be in the same domain as the add-in, which in your case is localhost:3000. However, that URL can be a blank page that immediately redirects to a login page. For more, see Auth with the Office Dialog.

这篇关于Outlook React加载项中的空白Auth对话框窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆