title: How to fix "Cannot read property 'getIdToken' of null" in angular firebase project
body: <p>I need to get the firebase token from my authService to the interceptor of my angular 5 project : when the user authentified for the first time, i can get the token id without problem but once i refresh the page (recall the API) i have this error message :<br>
  Cannot read property 'getIdToken' of null
      at AuthService.push../src/app/core/auth.service.ts.AuthService.getUserIdToken (auth.service.ts:144)
      at TokenInterceptor.push../src/app/core/token.interceptor.ts.TokenInterceptor.intercept (token.interceptor.ts:31)</p>
  
  <p>my function getToken in authService :</p>
  
  <pre><code>getUserIdToken(): Observable&lt;string&gt; {
    return fromPromise ( this.afAuth.auth.currentUser.getIdToken() );
  }
  </code></pre>
  
  <p>my interceptor code :
      intercept(request: HttpRequest, next: HttpHandler): Observable> {</p>
  
  <pre><code>    if (request.url.indexOf('oauthCallback') &gt; -1) {
          return next.handle(request);
      }
  
      this.auth = this.inj.get(AuthService); // inject the authservice manually (see https://github.com/angular/angular/issues/18224)
      return this.auth.getUserIdToken().pipe(
          switchMap(token =&gt; {
              request = request.clone({
                  setHeaders: {
                      Authorization: `Bearer ${token}`
                  }
              });
  
              return next.handle(request);
          })
      );
  }
  </code></pre>
  
  <p>Thank you for your help.</p>