Issue Setting up Dynamic Configuration

I am working on switching an Angular application to Auth0.
Currently working on deployment and needs dynamic configurations.

I followed this method:

function configInitializer(
  handler: HttpBackend,
  config: AuthClientConfig
) {
  return () =>
    new HttpClient(handler)
      .get('/config')
      .toPromise()
      // Set the config that was loaded asynchronously here
      .then((loadedConfig: any) => config.set(loadedConfig));
}

With this in my providers:

  providers: [
    {
      provide: APP_INITIALIZER,
      useFactory: configInitializer, // <- pass your initializer function here
      deps: [HttpBackend, AuthClientConfig],
      multi: true,
    },

When I try this I get the error of Configuration needs to be set AuthModule.forRoot() or AuthClientConfig.set.

When entering empty values on AuthModule.forRoot(), check the values before logging on to AuthService.
I find that the Auth0Client has no configuration set, and the Auth0COnfig does have the values.
The redirect goes to https:\authorization\ without my auth0 domain.

Thank you for your time.

Hi @rmejia,

Welcome to the Auth0 Community!

Make sure you also insert the imports like in the example below:

If you have any other questions feel free to reach out.

Have a good one,
Vlad