The bellow http interceptor fails to append the headers with the Authorization header nut it is succesfully adding the ‘x-test-header’ one
@Injectable()
export class AuthInterceptor implements HttpInterceptor {
constructor(public authenticationService: AuthenticationService) {}
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
let token = this.authenticationService.getToken();
request = request.clone({
setHeaders: {
Authorization: `Bearer ${token}`,
'x-test-header': 'foobar'
}
});
return next.handle(request);
}
}
The token retunred by the AuthenticationService
exists (I can see with Console.log) although I also tried to hard-type the value but it still missing