Search code examples
angularjsrestangularrestheart

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


I am frequently getting awful popup login window in our website. I am using AngularJs with RestAngular for login.

I want to implement below solution:

As per the Rest-Heart documents. RestAngular Documentation

Restangular is then configured to:

  • to add the No-Auth-Challenge request header to avoid the browser to prompt you for credentials with the awful popup login window.

Can anyone help me to configure the same using RestAngular?


Solution

  • If using restangular you might want to give a try to angular-restheart package https://github.com/SoftInstigate/angular-restheart

    It uses restangular and takes care of authentication and also set the no-auth-challenge header.

    Looking at the code you'll find how to configure restangular with default headers

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