auth0 http 拦截器 StaticInjectorError

auth0 http interceptor StaticInjectorError

按照 auth0 文档中关于在 angular 应用程序中设置 auth0 服务后调用 api 的文档

https://auth0.com/docs/quickstart/spa/angular/02-calling-an-api

并在更详细示例的指导下创建 httpinterceptor:

https://github.com/auth0/auth0-angular#configure-authhttpinterceptor-to-attach-access-tokens

我有拦截器:

imports: [
    BrowserModule,
    RouterModule,
    FontAwesomeModule,
    RecaptchaV3Module,
    FormsModule,
    HttpClientModule,
    AppRoutingModule,
    HttpClientModule,
    AuthModule.forRoot({
      domain: environment.auth0_domain,
      clientId: environment.auth0_client_id,
      redirectUri: window.location.origin,

      // The AuthHttpInterceptor configuration
      httpInterceptor: {
        allowedList: [
          'example.com/*',
          'example2.com/*'
        ],
      },
    })

  ],
  providers: [Addemailtomarketinglistservice,
    { provide: HTTP_INTERCEPTORS, useClass: AuthHttpInterceptor, multi: true },
    {provide: RECAPTCHA_V3_SITE_KEY, useValue: environment.recaptcha_site_key },
  Googlerecaptchaservice, AuthService, HidecomponentService, S3Service],
  bootstrap: [AppComponent]

我在进行任何 api 调用时收到以下错误:

ERROR NullInjectorError: StaticInjectorError(AppModule)[InjectionToken HTTP_INTERCEPTORS -> AuthClientConfig]: 
  StaticInjectorError(Platform: core)[InjectionToken HTTP_INTERCEPTORS -> AuthClientConfig]: 
    NullInjectorError: No provider for AuthClientConfig!

这里还有一些导入,看看我使用的是什么库

import { AuthHttpInterceptor, AuthModule } from '@auth0/auth0-angular';

import {HttpClientModule, HTTP_INTERCEPTORS} from '@angular/common/http';

这是我的 angular 版本输出:

 / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 8.3.29
Node: 12.14.1
OS: darwin x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.29
@angular-devkit/build-angular     0.803.29
@angular-devkit/build-optimizer   0.803.29
@angular-devkit/build-webpack     0.803.29
@angular-devkit/core              8.3.29
@angular-devkit/schematics        8.3.29
@angular/cli                      8.3.29
@ngtools/webpack                  8.3.29
@schematics/angular               8.3.29
@schematics/update                0.803.29
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

Auth0 Angular SDK- 用于将 Auth0 集成到 Angular 9+ 应用程序中的库。 请更新您的 angular。