title: APP_INITIALIZER doesn't return
body: <p>I want to load app settings before the Angular application starts.
  I copied in the code from another project but it stopped working.
  What is wrong?</p>
  <p>In <code>app.module.ts</code>:</p>
  <pre class="lang-js prettyprint-override"><code>providers: [
    {
      provide: APP_INITIALIZER,
      multi: true,
      deps: [AppSettingsService],
      useFactory: (appSettingsService: AppSettingsService) =&gt; {
        return () =&gt; {
          return appSettingsService.init();
        };
      }
    },
  ]
  </code></pre>
  <p>And here is the <code>app-settings.service.ts</code></p>
  <pre class="lang-js prettyprint-override"><code>@Injectable({
    providedIn: 'root'
  })
  export class AppSettingsService {
  
    private appsettings: Appsettings;
  
    constructor(private http: HttpClient) { }
  
    init(): Promise&lt;Appsettings&gt; {
      console.warn('AppSettingsService.init'); // This appears in the console.
      return this.http.get&lt;Appsettings&gt;('appsettings.json').pipe(
        tap(response =&gt; {
          console.warn('AppSettingsService.init.tap'); // This does not appear in the console.
          this.appsettings = response;
        })
      ).toPromise();
    }
  
    get authority(): string {
      return this.appsettings.jwtBearerSettings.authority;
    }
  }
  
  class Appsettings {
    baseUri: string;
    angularClientApiURI: string;
    jwtBearerSettings: JwtBearerSettings;
  }
  
  class JwtBearerSettings {
    authority: string;
  }
  </code></pre>
  <p>In the project from which this is copied I see in the browser tools a <code>GET</code> request for <code>appsettings.json</code> but not so in the project to which it has been copied.</p>
  <p><strong>Update</strong></p>
  <p>I have found that if I remove the <code>AuthInterceptor</code> from the <code>porviders</code> then it starts working.</p>
  <pre><code>@Injectable()
  export class AuthInterceptor implements HttpInterceptor {
  
    constructor(private authService: AuthService) { }
  
    intercept(request: HttpRequest&lt;unknown&gt;, next: HttpHandler): Observable&lt;HttpEvent&lt;unknown&gt;&gt; {
      return next.handle(this.addAuthenticationToken(request));
    }
  
    addAuthenticationToken(request: HttpRequest&lt;unknown&gt;): HttpRequest&lt;unknown&gt; {
      const token = this.authService.access_token; // (The id_token also works but can be much larger because it contains more claims.)
      if (token) {
        const tokenReq: HttpRequest&lt;any&gt; = request.clone({
          setHeaders: {
            Authorization: `Bearer ${token}`
          }
        });
        return tokenReq;
      }
      else {
        return request;
      }
    }
  }
  </code></pre>