title: Angular HTTP Interceptor does not execute Observable
body: <p>I am trying to implement a sliding expiry session in Angular, where the session should be extended with every interaction with the API.</p>
  <p>The HTTP interceptor is responsible for renewing the token after every response. The problem here is that <code>authService.renewToken()</code> call never really executes the request to the API. I do see <code>begin renew token</code> and <code>renewToken</code> log messages in the console but the token request to the API never fires.</p>
  <p>Any ideas what might be the problem here?</p>
  <pre><code>AuthenticationService
  
  
    public renewToken(token: string): Observable&lt;Token&gt; {
  
      console.log('renewToken');
      
      return this.api
        .createSession(token)
        .pipe(tap((newToken) =&gt; {
            console.log(token === newToken.token);
  
            this.saveToken(newToken);
          }));
    }
  </code></pre>
  <pre><code>@Injectable()
  export class ResponseInterceptor implements HttpInterceptor {
    private refreshingToken = false;
    private tokenSubject = new Subject&lt;any&gt;();
  
    constructor(private injector: Injector) { }
  
    intercept(req: HttpRequest&lt;any&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;any&gt;&gt; {
      return next.handle(req).pipe(tap(event =&gt; {
  
        if (this.shouldIntercept(event)) {
          this.tokenSubject.next(null);
          this.refreshingToken = true;
  
          const authService = this.injector.get(AuthenticationService);
  
          const currentToken = authService.getToken();
  
          console.log('begin renew token');
          
          return authService.renewToken(currentToken).pipe(
            switchMap((newToken: Token) =&gt; {
              console.log(&quot;newToken Recieved:&quot;, newToken.token);
              this.tokenSubject.next(newToken);
              return next.handle(req);
            }),
            finalize(() =&gt; { this.refreshingToken = false; })
          )
        }
  
        return next.handle(req);
      }), catchError(errorResponse =&gt; {
        this.refreshingToken = false;
  
        if (errorResponse.status === 401) {
          console.log('Unauthorised response received.');
          this.injector.get(Router).navigate(['error']);
        }
        return throwError(errorResponse);
      }));
    }
  </code></pre>