xhr 使用 Windows 身份验证服务

时间:2021-01-02 08:23:25

标签: xmlhttprequest windows-authentication

要使用 Windows 身份验证访问浏览器 Web 服务,我添加以下内容:xhr.withCredentials= true;

够了吗?有时浏览器仍会显示要求用户赢得凭据的窗口。更多详情。

https://localhost:44386/api 使用 Windows 身份验证。有些用户是允许的,有些则不是 - 用于测试。这是js代码。可以吗?有时,用户仍然会收到对话框,询问他们的 Windows 凭据。

function send() {
            const url = 'https://localhost:44386/api/values';

            var xhr = new XMLHttpRequest();
   
            xhr.withCredentials = true;
            xhr.open("GET", url);
            xhr.onload = () => requestComplete(xhr);
            xhr.send();
        };

0 个答案:

没有答案