Angularjs $http侦听器,更改标头
我有acces令牌,发送头Angularjs $http侦听器,更改标头,angularjs,Angularjs,我有acces令牌,发送头 $http({ method: "GET", url: 'someUrl', withCredentials: true, headers: { "Authorization": "Bearer " + userService.access_token }
$http({
method: "GET",
url: 'someUrl',
withCredentials: true,
headers: {
"Authorization": "Bearer " + userService.access_token
}
});
},
在访问时,令牌过期,服务器返回403。
我已经有一个拦截器在请求新的令牌
'responseError': function(rejection) {
//getting new access token
//need to change header for new acces_token, before resending
$injector('$http').(rejection.config);
return //somePromise;
}
是否可以修改rejection.config标头,向标头注入新的访问令牌,然后重新发送修改后的请求