.net - 如何制作 React App 的 Windows 身份验证
问题描述
Web API 已在 .Net 中使用 Windows 身份验证创建。当我在 React APP 中调用 API 时得到 401 Unauthorized。Web API 在具有 Windows 身份验证的浏览器中工作正常。
axios.get('http://.../.../user/Data')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});```
解决方案
随着fetch
我设置credentials: include
选项。另外,我认为Access-Control-Allow-Credentials
需要在后端设置标题。
我是一名前端开发人员,所以我不确定为 Windows 身份验证配置后端的全部内容。
推荐阅读
- javascript - useState 和初始值作为数组不起作用
- r - 多因子水平的两个分数之间的 Cohen d
- javascript - 构造函数内的函数返回未定义
- powerbi - 如何根据可视化中的参数刷新 Power BI 报表?
- python - MySQL 连接器 + Python 的内存泄漏
- asp.net-core - 如何对 HttpContext 用户身份排序?
- angular - 您是否需要取消订阅 Angular 中的路由器参数?
- spring-boot - 当两者都部署在 kubernetes 时,带有 spring boot 的 Jaeger 不起作用
- sql - 如何将 WHERE 子句中的这个 CASE 语句变成多选参数?
- amazon-web-services - 在 AWS 中使用打包程序构建 qcow2 映像