首页 > 解决方案 > 如何制作 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);
    });```

标签: .netreactjsaxioswindows-authentication

解决方案


随着fetch我设置credentials: include选项。另外,我认为Access-Control-Allow-Credentials需要在后端设置标题。

我是一名前端开发人员,所以我不确定为 Windows 身份验证配置后端的全部内容。


推荐阅读