angularjs - Laravel set JWT token into authentication header -


i using jwt token based authentication laravel/ angularjs application. @ current stage, users can log in, , token generated , saved in local storage (please see screenshot). enter image description here , have tested api, works token local storage (please see screenshot). enter image description here now, need redirect user after login.

app.controller('authcontroller', ['$auth', '$state', '$location', '$window', function($auth, $state, $location, $window){ var vm = this;  vm.login = function() {      var credentials = {         name: vm.name,         password: vm.password     };      // use satellizer's $auth service login     $auth.login(credentials)         .then(function(data) {              // if login successful, redirect users state             //$state.go('users', {});             $window.location.href = 'api/project';         }).catch(function(data){             console.log('error', data);             alert('wrong!!!!!');     });  }  }]); 

but doesn't work. because in request header, token not included in request header authorization. returns error, token not provided.

help, please!!!!

[edit] have done search, noticed $http set header token automatically. here redirect page, didn't use $http.


Comments