-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MsalModule.forRoot throws AoT error #386
Comments
@sharppc Thanks for reporting this. I will be doing another release in this week. |
Having the same issue. If I remove the MsalModule from my app, the AOT compilation error goes away. |
@RobARichardson @sharppc This is fixed and released in @azure/msal-angular 0.1.1 . Please check. |
Thanks, @nehaagrawal. Compilation error is gone, but I'm now seeing this warning in its place
Furthermore, while I'm not 100% certain this is related, when my app is compiled for production, Msal no longer appears to be adding the Authorization Token to the Http Request Headers therefore all XHR requests are getting a 401 Unauthorized. |
@RobARichardson This is working fine. Can you please try our sample here and run "ng build --prod --aot". I was able to the token and it was added in the header. |
@nehaagrawal I pulled down the sample and tried it. When I run the app using "ng serve", everything works normally. However, when I run the app using "ng serve --prod --aot", I'm seeing the same behavior as my own app: the requests to graph.microsoft.com/v1.0/me are missing the Authorization header and fail due to a 401 Unauthorized. |
@RobARichardson Sorry I didn't get earlier that you were running "ng serve --prod --aot" instead of "ng serve". I was trying to build it using aot using "ng build --prod --aot" and then run it using "ng serve" and hence I couldn't reproduce it. I can reproduce it now. I will fix it and release it soon. Thanks for reporting this. |
@RobARichardson This is fixed and released in msal-angular 0.1.2. You will need to change the way you pass the protectedResourceMap. Please check readme for more details. |
I'm submitting a...
Current behavior
The MsalModule.forRoot function throws an AoT error when compiling with v6.1.
It may have to do with the use of the window object. The compiler throws error: Error: Internal error: unknown identifier undefined
Expected behavior
I expect AoT compilation to work, regardless of version. If it is because of the Window interface being used as an injection token, a fix is described here: angular/angular#12631 (comment)
Minimal reproduction of the problem with instructions
Import MsalModule with any forRoot configuration and compile with Angular compiler > v6 and use --aot flag.
The text was updated successfully, but these errors were encountered: