Gets and sets configuration for the internal Authok client.
This can be used to provide configuration outside of using
AuthModule.forRoot, i.e. from a factory provided by
APP_INITIALIZER.
usage
// app.module.ts// ---------------------------import { AuthModule, AuthClientConfig } from'@authok/authok-angular';// Provide an initializer function that returns a PromisefunctionconfigInitializer(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.forRootimports: [// other imports..HttpClientModule,AuthModule.forRoot(), //<- don't pass any config here],providers: [ {provide:APP_INITIALIZER,useFactory:configInitializer, // <- pass your initializer function heredeps: [HttpClient, AuthClientConfig],multi:true, },],
Gets and sets configuration for the internal Authok client. This can be used to provide configuration outside of using AuthModule.forRoot, i.e. from a factory provided by APP_INITIALIZER.