We're almost done; the last thing we need to do is to provide our client with a HttpInterceptor that will capture the Http 401 - Unauthorized errors and try to refresh the access token accordingly. It goes without saying that we need to find a way to have it trigger only once--to avoid endless attempts--and to resend the failed request in case of success.
From Solution Explorer, right-click to the /ClientApp/app/services/ folder and add a new auth.response.interceptor.ts TypeScript file, filling it with the following content:
import { Injectable, Injector } from "@angular/core";import { Router } from "@angular/router";import { HttpClient, HttpHandler, HttpEvent, HttpInterceptor, HttpRequest, HttpResponse, HttpErrorResponse ...