I’d like to use a method in a export function defined in a class file.
export function MSALInstanceFactory(): IPublicClientApplication {
return new PublicClientApplication({
auth: AzureService.getConfiguration(), <-------- Compilation Error
cache: {
cacheLocation: BrowserCacheLocation.LocalStorage,
storeAuthStateInCookie: isIE, // set to true for IE 11. Remove this line to use Angular Universal
}
});
}
export class AzureModule { }
This is the Service Class
@Injectable()
export class AzureService {
constructor(private identityManagerApiRestService: IdentityManagerApiRestService) { }
getConfiguration(): BrowserAuthOptions {
let options: BrowserAuthOptions;
this.identityManagerApiRestService.getAuthenticationConfiguration().subscribe(response =>{
options.clientId = response.authenticationConfiguration.clientId;
options.authority = response.authenticationConfiguration.authority;
options.redirectUri = response.authenticationConfiguration.redirectUri;
});
return options;
}
}
How can I use AzureService.getConfiguration() method in the exported function method in the Module. I want this because the values are dynamic and they are obtained in a rest call.