我不想在每个http请求中都传递承载令牌,因此为了使其自动化,我执行了以下操作:
angular.module('projectApp').run(function ($http, $rootScope, $location) {
$http.defaults.headers.common.Authorization = 'Bearer ' + localStorage.getItem('token');
}
但是当有一个页面不需要身份验证时,头部也会被传递。有没有一种方法可以选择不传递这个头(但作为默认传递)?
https://stackoverflow.com/questions/41513730
复制相似问题