I implemented authInterceptorService so when response is not authorize I send request for new token and then I want to resend previoes request. So I need to store it somewhere and resend, what is best way to do it?
var _responseError = function (rejection) {
if (rejection.status === 401) {
var authService = $injector.get('authService');
var authData = localStorageService.get('authorizationData');
if (authData) {
authService.refreshToken().then(function (response) {
//redirect to original request
},
function (err) {
$location.path('/login');
});
}
authService.logOut();
$location.path('/login');
}
return $q.reject(rejection);
}