-
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
MSAL Angular Wrapper is not passing protectedResourceMap when building --prod (with AOT) #407
Comments
@andersonferrari This is a know issue and we already have a fix for this and needs to be released. Map is not supported by AOT and hence the issue. I will update you here once I release this fix. |
Good to know about that! We will be waiting for this fix! |
@andersonferrari Once we release the fix, you will need to pass the map as an array. Something like this :- export const protectedResourceMap:[string, string[]][]=[ ['https://buildtodoservice.azurewebsites.net/api/todolist',['api://a88bb933-319c-41b5-9f04-eff36d985612/access_as_user']] , ['https://graph.microsoft.com/v1.0/me', ['user.read']] ]; |
Great! that is pretty much the workaround that I've found and I think that can cover all cases (for protected and unprotected resources)! thank you! |
Fixed and released in msal-angular 0.1.2. Please check the read me for how to use protectedResourceMap. I am closing it for now. Please reopen if the issue exists. |
Hi, Acquiring of Access Token is working in DEV but Not in PROD. |
HI, msal angular version which am using is "@azure/msal-angular": "^0.1.2", export const protectedResourceMap:[string, string[]][]=[ ['http://localhost:8133/api/FrameworkData/ReleaseManagement/GetAllFrameworkDetails',['api://d6d2dc96-6757-47f7-83bd-2212e5e9099d/access_as_user']], ['https://graph.microsoft.com/v1.0/me', ['user.read']] ]; Web api is registered and working fine with C# based web app with Oauth2.0 and openidConnect. my module.ts imports: [ please help me. i stuck since 2 days. |
Please 1) add client application by exposing api,2) do run your api on localhost |
I'm submitting a...
All Browsers:
Library version
Library version: 0.2.2
Current behavior
We used angular cli to scaffold the project and when we run: ng build --prod and run the project... the protectedResouceMap Map JS object do not go to MSAL lib.
This behaviour do not occur with dev build (ng build)... only when AOT (ahead-of-time) compilation is active, which is the case when we include --prod
workaround:
ex: export const protectedResourceMap = [[config.PathAPI, [config.B2cScope]]];
. https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/src/msal-config.ts#L19
. https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/src/msal.service.ts#L37
. protectedResourceMap: new Map(config.protectedResourceMap),
then it works (even with --prod /aot)
I have logged this question on stackoverflow, but I didn't get an answer until now:
https://stackoverflow.com/questions/51959376/msal-for-angular-preview-angular-webpack-aot-compilation-not-including-resourcem
Expected behavior
When we compile the project with AOT (--prod) it should pass the protectedResourceMap to MSAL (serialize statically the Map object... passing an array instead of a Map object workaround the problem, but does not look like a good solution)
Minimal reproduction of the problem with instructions
If you inspect the code, you will see AOT did not serialize protectedResourceMap along with the other parameters
If you need more info, please reach out to me...
let me know in case you find a way to bypass this problem
thank you very much!
The text was updated successfully, but these errors were encountered: