When trying to dynamically set the subscription key through the APP_INITIALIZER, we need to use a setAzureMapsConfiguration function in order to provide azure maps with configured element
providers: [ { provide: APP_INITIALIZER, useFactory: () => new Promise((res, rej) => {... setAzureMapsConfiguration()}), deps: [...], multi: true } ],
However, this would set
{ provide: AZUREMAPS_CONFIG, useValue: configuration },
AZUREMAPS_CONFIG to have value of undefined, as we are not providing it directly through
AzureMapsModule.forRoot({ authOptions: environment.authOptions })
or overriding it in the app module with
{ provide: AZUREMAPS_CONFIG, useValue: { authOptions: environment.authOptions } }
Without this token the AtlasRestAuthenticationInterceptor is failing, because if loaded asynchronously, the token is never set in the first place. I assume that we would still need to provide this token in order to make interceptor work. So that, it wouldn't really work with APP_INITIALIZER
When trying to dynamically set the subscription key through the APP_INITIALIZER, we need to use a
setAzureMapsConfiguration
function in order to provide azure maps with configured elementproviders: [ { provide: APP_INITIALIZER, useFactory: () => new Promise((res, rej) => {... setAzureMapsConfiguration()}), deps: [...], multi: true } ],
However, this would set{ provide: AZUREMAPS_CONFIG, useValue: configuration },
AZUREMAPS_CONFIG to have value of undefined, as we are not providing it directly throughAzureMapsModule.forRoot({ authOptions: environment.authOptions })
or overriding it in the app module with{ provide: AZUREMAPS_CONFIG, useValue: { authOptions: environment.authOptions } }
Without this token the AtlasRestAuthenticationInterceptor is failing, because if loaded asynchronously, the token is never set in the first place. I assume that we would still need to provide this token in order to make interceptor work. So that, it wouldn't really work with APP_INITIALIZER