Outlook加载项出现cors问题 [英] cors issue with Outlook Add-In

查看:52
本文介绍了Outlook加载项出现cors问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个Outlook加载项,并且试图向Jira发出提取请求.但是,我遇到了我认为是CORS的问题,并且不确定如何解决它.

I am writing an Outlook Add-in and I am trying to make a fetch request to Jira. However, I am running into what I think is a CORS issue and I'm not sure how to get around it.

错误消息显示:

"[已阻止] https://localhost:3000/index.html?_host_Info=Outlook$Mac$16.02$en-US上的页面不允许显示来自http://mysite.atlassian.net/rest/api/2/myself的不安全内容."

"[blocked] The page at https://localhost:3000/index.html?_host_Info=Outlook$Mac$16.02$en-US was not allowed to display insecure content from http://mysite.atlassian.net/rest/api/2/myself."

是否可以通过Outlook加载项发出获取请求以避开CORS?

Is there any way to make a fetch request from an Outlook Add-in to get around CORS?

我的加载项只是一个基于React的前端应用程序,并且获取请求需要基本身份验证,该身份验证在邮递员中可以正常工作(当然,它在浏览器外部,但Outlook加载项在浏览器组件中运行).

My add-in is just a react based front-end app and the fetch request requires basic authentication which works fine in postman (which of course is outside the browser but outlook add-ins run in a browser component).

推荐答案

在外接程序所在的域之外进行呼叫时,您需要在外接程序清单中指定这些域:

When making calls outside the domain your add-in is hosted in, you need to specify those domains in your add-in's manifest:

<AppDomains>
    <AppDomain>http://mysite.atlassian.net/</AppDomain>
    <AppDomain>https://mysite.atlassian.net/</AppDomain>
</AppDomains>

这篇关于Outlook加载项出现cors问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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