Send request with auth token in header in angularjs
<p>I implemented jwt stateless in backend , so except login and signup all other method has to intercept in angularjs and sending auth token to server in request header .But token is not sending mean not seeing in reqest header in console(developer tools).</p>

<p>This is my interceptor.js :</p>

<pre><code>/**
 * 
 */
/* Interceptor declaration */
rootApp.factory('authInterceptor', function ($rootScope, $q, $sessionStorage, $location,$window) {
    return {
        request: function (config) {
            //config.headers['Content-Type'] = 'application/json';
            config.headers = config.headers || {};
            if ($window.sessionStorage.token) {
                config.headers.Authorization =  'Bearer '  + $window.sessionStorage.token;
                //config.headers['x-auth-token'] ='Bearer '  + $window.sessionStorage.token;
            }
            return config;
        },
        response: function (response) {

            if(response.status === 200){                
                if(response.data &amp;&amp; response.data.success === false){
                    if($rootScope.authFailureReasons.indexOf(response.data.reason) !== -1){
                        $location.path('/login');
                    }
                }
            }

            if (response.status === 401) {
                $location.path('/');
            }

            return response || $q.when(response);
        },
        'responseError': function (rejection) {
            return $q.reject(rejection);
        }
    };
});

rootApp.config(['$httpProvider', function ($httpProvider) {
      // $httpProvider.interceptors.push('headerInterceptor');
        $httpProvider.interceptors.push('authInterceptor');
    }]);
</code></pre>

<p>And service.js file is:</p>

<pre><code>rootApp.service('adminService', function ($rootScope, $http, $q,$window) {

    return {
        inviteUser: function (user) {

            var deferred = $q.defer();

            $http({
                method: 'POST',
                url:$rootScope.baseUrl+'api/v1/admin/user/add',
                data:user


            }).success(function (response, status, headers, config) {



                deferred.resolve(response);
            }).error(function () {
                // Something went wrong.
                deferred.reject({'success': false, 'msg': 'Oops! Something went wrong. Please try again later.'});
            });

            return deferred.promise;

        }
    };
});
</code></pre>

<p>In server side X-AUTH-TOKEN is allowed in headers too.Where i am going wrong 
Please help.</p>