25,130 questions
angular production compilation: function call is not supported in decorates but PublicClientApplication was called
Tarek, Taher
90
Reputation points
after enabling azure AD auth in my SPA app using MSAL. everything works perfectly on dev env but while using ng build --prod i get error "error during template compile of 'AppModule' function calls are not supported in decorators but 'PublicClientApplication' was called." app.module.ts as following
imports..
@NgModule({
declarations: [
],
imports: [
..,
MsalModule.forRoot(new PublicClientApplication(
{
auth: {
clientId: environment.clientId,
authority: environment.authority,
redirectUri: environment.redirectUri,
postLogoutRedirectUri: environment.postLogoutRedirectUri
},
cache: {
cacheLocation: "localStorage",
storeAuthStateInCookie: isIE, //declared const
},
}),
{
interactionType: InteractionType.Redirect,
authRequest: {
scopes: ['User.ReadWrite']
}
},
{
interactionType: InteractionType.Redirect, // MSAL Interceptor Configuration
protectedResourceMap: new Map([
['https://graph.microsoft.com/v1.0/', ['User.read']]
])
}),
],
exports: [],
providers: []
})
export class AppModule { }
Microsoft Security | Microsoft Entra | Microsoft Entra ID
Sign in to answer