angularjs - Add access token to every request header in Angular js -


this question has answer here:

i working node js rest api. in authentication process api returns access token. need add access token every request common place.

you can use http interceptor
code looks follow

$httpprovider.interceptors.push(function($q, $cookies) {   return {    'request': function(config) {         config.headers['token'] = $cookies.logintokencookie;         return config;     }   }; }); 

from post


Comments

Popular posts from this blog

How to check data type in C++? -

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

formula - R: how to pass in a reference to the variable in glm or lm? -