angular - Angular 和 IIS Windows 身份验证通信
问题描述
我们正在构建一个当前在localhost:4200上运行的 Angular 应用程序。
我们还有一个在 IIS 上运行的 API(与我们的 Dynamics CRM 后端通信) - localhost:8080/api (/api是 IIS 上:8080下的子应用程序)
我们希望我们的 Angular 应用程序能够使用Windows Authentication与我们的 IIS 托管 API 进行通信。
我们尝试像这样使用proxy.config:
const Agent = require('agentkeepalive');
module.exports = {
'/api': {
target: 'http://localhost:8080/api',
secure: false,
agent: new Agent({
maxSockets: 100,
keepAlive: true,
maxFreeSockets: 10,
keepAliveMsecs: 100000,
timeout: 6000000,
freeSocketTimeout: 90000
}),
onProxyRes: proxyRes => {
let key = 'www-authenticate';
proxyRes.headers[key] = proxyRes.headers[key] &&
proxyRes.headers[key].split(',');
}
}
};
然后运行ng serve --proxy-config proxy.config.js
但是我们收到了401 Unauthorized响应。
PS 我们对 API 的所有 HTTP 请求都是POST请求,因此通过我们的 API 对 CRM 中端点的调用看起来像localhost:8080/api/api/getUser。
解决方案
推荐阅读
- android - Flutter Firestore 如何列出我只有聊天记录的人?
- javascript - JavaScript 无法从 HTML 表单正确运行
- python - Discord.py 和 gRPC 可以一起使用吗?
- git - git revert 在先前提交中的反向效果
- javascript - 通过分析广告数据,我一直在确定 BLE 设备是否可连接。这是我的代码示例和学习指南
- c# - 我需要使用 WinForms 将多个 A6 大小的页面打印到单个 A3 大小的页面
- boost - 提升最大连接组件的大小
- android - 防止在不增加 SDK 版本的情况下在 MIUI 中强制暗模式
- python - pyqt5 - 工作类不发射到主线程
- robotframework - 如何在 log.html 中有多行关键字文档