title: Trying to repeat a http request after refresh token with a interceptor in angular 7
body: <p>I'm trying to automate the refresh token requests upon receiving an error 401 with angular 7.</p>
  
  <p>Between that I do not find much documentation of how to do it with angular 7 and that I do not have previous knowledge of angular or rxjs I am becoming a little crazy</p>
  
  <p>I think it's almost completed, but for some reason the second next.handle(newReq) dont send the request (in google chrome network debugger only apears first request)</p>
  
  <p>i'm gettin the response of refresh and making processLoginResponse(res) correctly</p>
  
  <p>you can see here my interceptor</p>
  
  <pre><code>intercept(req: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
  
  let newReq = req.clone();
  
  return next.handle(req).pipe(
    catchError(error =&gt; {
      if (error.status == 401) {
        this._authenticationService.refresh().subscribe(
          res =&gt; {
            this._authenticationService.processLoginResponse(res);
            newReq.headers.set("Authorization", "Bearer " + this._authenticationService.authResponse.token)
            return next.handle(newReq)
          },
          error =&gt; {
            this._authenticationService.logOut();
          });
      }
      throw error;
    })
  );
  </code></pre>