I am using MSAL which is a microsoft authentication library for my angular project. In my app.module.ts
, I added the msalModule in the import section as follows:
This is fine while coding and figuring how to get it work during development, but I need to dynamically set variables like redirectUri
, postLogoutRediectUri
, and the clientID
to different values for the production environment. I tried using an object like:
Object.getClientID()
, Object.getRedirectUri()
, but I get an error that functions are not allowed in decorator.
Is there a way to set the static variable before the app.module.ts
is called? Or is there another way to dynamically load the correct environment variables for MSAL?
Thanks
salModule.forRoot({
clientID: "<my-client-id>",
authority: "https://tenant.b2clogin.com/tfp/tenant.onmicrosoft.com/B2C_1_Signin",
redirectUri: "http://localhost:4200/dashboard",
/* default is true */
validateAuthority: false,
cacheLocation : "localStorage",
postLogoutRedirectUri: "http://localhost:4200/",
popUp: false,
})