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

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -