I am trying to send a token in a header on every request. Firstly I tried to do more complicated things, like saving in local storage but now, here I am trying to add a damn header with a token string random and it's still not add the header. Why? This is the app.js, I let here only this:
'use strict';
function testInterceptor() {
return {
request: function(config) {
config.headers['x-token'] = 'lalalalala';
console.log(config);
console.log("Aaa");
return config;
}
}
}
var app = angular.module('myapp', ['oc.lazyLoad', 'LocalStorageModule', 'oc.lazyLoad', 'ngRoute', 'naif.base64', 'ui.router', 'ngAnimate', 'ui.bootstrap']);
app.factory('testInterceptor', testInterceptor);
app.config(function($httpProvider) {
$httpProvider.interceptors.push('testInterceptor');
});
In console.log it doesn't even printed anything. I also commented the authentication providers and let:
Default:
Anonymous: ~
in security.yml
And when I try with postman or in browser to call my app, it doesn't add the header. Why am I doing wrong?