Long story short, I have a structure in my angularjs app which is basically the following: 1. There is an 'authService' that is in charge of requesting access tokens, and refresh tokens. 2. There is an 'authInterceptorService' that adds the token to the header of the request, however, the tricky part is here: this service depends on the authService, for generating a new access token using a refresh token in case the access token is expired and the request is 401en, which means there will ultimately be a circular dependency, when I use the $httpProvider service to register the interceptor:
authService <- authInterceptorService <- $http <- authService
My questions is how is it possible to get around this issue when your interceptor needs to be able to issue a new access token using the refresh token and REsend the request?