如何添加 "No-Auth-Challenge" 请求 header 以避免浏览器在 restAngular 中使用可怕的弹出登录 window 提示您输入凭据

How to add the "No-Auth-Challenge" request header to avoid the browser to prompt you for credentials with the awful popup login window in restAngular

我经常在我们的网站上收到 糟糕的弹出式登录 window。我正在使用 AngularJs 和 RestAngular 进行登录。

我想实施以下解决方案:

根据 Rest-Heart 文档。 RestAngular Documentation

然后将 Restangular 配置为:

任何人都可以使用 RestAngular 帮助我进行配置吗?

如果使用 restangular,您可能想尝试 angular-restheart 包 https://github.com/SoftInstigate/angular-restheart

它使用 restangular 并负责身份验证,还设置 no-auth-challenge header。

查看代码,您会发现如何使用默认 headers

配置 restangular
RestangularProvider.setDefaultHeaders      ({
            'Accept': 'application/hal+json',
            'Content-Type': 'application/json',
            'No-Auth-Challenge': 'true'
        });