mercredi 3 avril 2019

how to generate dynamic data for adal-angular6 configuration

I'm currently connecting to AAD, and azure graph api, fetching all I need and its great. My problem is that my 'adalConfig' properties are written hard coded like this :

in app.module > imports:

         c.MsAdalAngular6Module.forRoot({
         tenant: '080werg-1e3r-5dnb-8c3b-e37ttrr8ee8',
         clientId: '080werg-080werg-080werg-080werg-080werg',
         redirectUri: window.location.origin,
         endpoints: {
            "https://cloudcrp-client.azurewebsites.net": "080werg- 80werg- 
             080werg- 080werg- 080werg",
         },
         navigateToLoginRequestUrl: false,
    }),

This is very bad for me because we have several clients that ill need different information for each one of them. what I want to do is getting the information from the server with the correct details. So basically using the .forRoot somehow in an async way.

I've found this article : https://devblogs.microsoft.com/premier-developer/angular-how-to-microsoft-adal-for-angular-6-with-configurable-settings/ I thought its related enough to what I want to achieve, but I just can't figure it out.

TIA




Aucun commentaire:

Enregistrer un commentaire