Gets and sets configuration for the internal Auth0 client. This can be
used to provide configuration outside of using AuthModule.forRoot, i.e. from
a factory provided by APP_INITIALIZER.
// Provide an initializer function that returns a Promise functionconfigInitializer( http: HttpClient, config: AuthClientConfig ) { return () => http .get('/config') .toPromise() .then((loadedConfig: any) =>config.set(loadedConfig)); // Set the config that was loaded asynchronously here }
// Provide APP_INITIALIZER with this function. Note that there is no config passed to AuthModule.forRoot imports: [ // other imports..
HttpClientModule, AuthModule.forRoot(), //<- don't pass any config here ], providers: [ { provide:APP_INITIALIZER, useFactory:configInitializer, // <- pass your initializer function here deps: [HttpClient, AuthClientConfig], multi:true, }, ],
Gets and sets configuration for the internal Auth0 client. This can be used to provide configuration outside of using AuthModule.forRoot, i.e. from a factory provided by APP_INITIALIZER.
Usage