2

我正在使用 AJAX 调用 IdP 服务,withCredentials = true。它返回带有重定向到另一个 URL 的表单的响应消息。仅在 Google chrome 中,它会提示输入我假设收到 401 的凭据,但我希望它失败,而不是提示输入凭据。

我在 Edge 中尝试了完全相同的代码,但它确实以 401 状态失败。没有凭据提示。此外,一些 stackoverflow 似乎暗示 WWW-Authenticate 需要被删除或黑客攻击,但这似乎破坏了已经就位的内置凭证协商 (OOTB)。

以下是两种浏览器(Edge 和 Chrome)中使用的片段

$.ajax({
        type: form.method,
        url: form.action,
        data: formData,
        xhrFields: {
            withCredentials: true
        },
        success: function(result) {
            // Do something
        },
        error: function(xhr, status, exception) {
            // Do something
        }
    });

预期:在 Chrome 中,不应显示凭据提示。

实际:Chrome 显示凭据提示。

4

0 回答 0