{"action":"created","issue":{"url":"https://api.github.com/repos/AzureAD/microsoft-authentication-library-for-js/issues/407","repository_url":"https://api.github.com/repos/AzureAD/microsoft-authentication-library-for-js","labels_url":"https://api.github.com/repos/AzureAD/microsoft-authentication-library-for-js/issues/407/labels{/name}","comments_url":"https://api.github.com/repos/AzureAD/microsoft-authentication-library-for-js/issues/407/comments","events_url":"https://api.github.com/repos/AzureAD/microsoft-authentication-library-for-js/issues/407/events","html_url":"https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/407","id":353925003,"node_id":"MDU6SXNzdWUzNTM5MjUwMDM=","number":407,"title":"MSAL Angular Wrapper is not passing protectedResourceMap when building --prod (with AOT)","user":{"login":"andersonferrari","id":5047415,"node_id":"MDQ6VXNlcjUwNDc0MTU=","avatar_url":"https://avatars2.githubusercontent.com/u/5047415?v=4","gravatar_id":"","url":"https://api.github.com/users/andersonferrari","html_url":"https://github.com/andersonferrari","followers_url":"https://api.github.com/users/andersonferrari/followers","following_url":"https://api.github.com/users/andersonferrari/following{/other_user}","gists_url":"https://api.github.com/users/andersonferrari/gists{/gist_id}","starred_url":"https://api.github.com/users/andersonferrari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andersonferrari/subscriptions","organizations_url":"https://api.github.com/users/andersonferrari/orgs","repos_url":"https://api.github.com/users/andersonferrari/repos","events_url":"https://api.github.com/users/andersonferrari/events{/privacy}","received_events_url":"https://api.github.com/users/andersonferrari/received_events","type":"User","site_admin":false},"labels":[{"id":686542871,"node_id":"MDU6TGFiZWw2ODY1NDI4NzE=","url":"https://api.github.com/repos/AzureAD/microsoft-authentication-library-for-js/labels/Fixed","name":"Fixed","color":"bfd4f2","default":false}],"state":"closed","locked":false,"assignee":{"login":"nehaagrawal","id":6045787,"node_id":"MDQ6VXNlcjYwNDU3ODc=","avatar_url":"https://avatars3.githubusercontent.com/u/6045787?v=4","gravatar_id":"","url":"https://api.github.com/users/nehaagrawal","html_url":"https://github.com/nehaagrawal","followers_url":"https://api.github.com/users/nehaagrawal/followers","following_url":"https://api.github.com/users/nehaagrawal/following{/other_user}","gists_url":"https://api.github.com/users/nehaagrawal/gists{/gist_id}","starred_url":"https://api.github.com/users/nehaagrawal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nehaagrawal/subscriptions","organizations_url":"https://api.github.com/users/nehaagrawal/orgs","repos_url":"https://api.github.com/users/nehaagrawal/repos","events_url":"https://api.github.com/users/nehaagrawal/events{/privacy}","received_events_url":"https://api.github.com/users/nehaagrawal/received_events","type":"User","site_admin":false},"assignees":[{"login":"nehaagrawal","id":6045787,"node_id":"MDQ6VXNlcjYwNDU3ODc=","avatar_url":"https://avatars3.githubusercontent.com/u/6045787?v=4","gravatar_id":"","url":"https://api.github.com/users/nehaagrawal","html_url":"https://github.com/nehaagrawal","followers_url":"https://api.github.com/users/nehaagrawal/followers","following_url":"https://api.github.com/users/nehaagrawal/following{/other_user}","gists_url":"https://api.github.com/users/nehaagrawal/gists{/gist_id}","starred_url":"https://api.github.com/users/nehaagrawal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nehaagrawal/subscriptions","organizations_url":"https://api.github.com/users/nehaagrawal/orgs","repos_url":"https://api.github.com/users/nehaagrawal/repos","events_url":"https://api.github.com/users/nehaagrawal/events{/privacy}","received_events_url":"https://api.github.com/users/nehaagrawal/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2018-08-24T20:56:43Z","updated_at":"2018-09-18T11:42:01Z","closed_at":"2018-09-11T04:15:43Z","author_association":"NONE","body":"## I'm submitting a...\r\n<!-- Check one of the following options with \"x\" -->\r\n<pre><code>\r\n[ ] Regression (a behavior that used to work and stopped working in a new release)\r\n[ x ] Bug report  <!-- Please search GitHub for a similar issue or PR before submitting -->\r\n[ ] Performance issue\r\n[ ] Feature request\r\nor [ x ] Documentation issue or request\r\n[ ] Other... Please describe: \r\n*** it can be a bug or something missing in the documentation\r\n</code></pre>\r\n\r\n## All Browsers:\r\n\r\n## Library version\r\n\r\nLibrary version: 0.2.2\r\n\r\n## Current behavior\r\n\r\nWe 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.\r\nThis 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\r\n\r\n\r\nworkaround:\r\n- if a pass an array instead of a Map as protected resource map \r\n   ex: export const protectedResourceMap = [[config.PathAPI, [config.B2cScope]]];\r\n- and If a change from Map<string, Array<string>> to Any (or array) here:\r\n  . https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/src/msal-config.ts#L19\r\n- and recreate the Map here:\r\n  . https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/src/msal.service.ts#L37\r\n  . protectedResourceMap: new Map(config.protectedResourceMap),\r\nthen it works (even with --prod /aot)\r\n\r\nI have logged this question on stackoverflow, but I didn't get an answer until now:\r\nhttps://stackoverflow.com/questions/51959376/msal-for-angular-preview-angular-webpack-aot-compilation-not-including-resourcem \r\n\r\n## Expected behavior\r\nWhen 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)\r\n\r\n## Minimal reproduction of the problem with instructions\r\n\r\n1. Scaffold a new Angular project with angular cli\r\n2. Create a Javascript Map object to hold the protectedResourceMap (string with URL and array with scopes) as described in the documentation: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/README.md\r\n3. add the protectedResourceMap into the ngModule declaration\r\n4. run build for production... that will turn on AHEAD-OF-TIME/AOT compilation by default: ng build --prod\r\n5. run your solution and login... login goes ok, but subsequent calls to APIs don't work.\r\nIf you inspect the code, you will see AOT did not serialize protectedResourceMap along with the other parameters\r\n\r\nIf you need more info, please reach out to me...\r\nlet me know in case you find a way to bypass this problem\r\nthank you very much!\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/AzureAD/microsoft-authentication-library-for-js/issues/comments/422360295","html_url":"https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/407#issuecomment-422360295","issue_url":"https://api.github.com/repos/AzureAD/microsoft-authentication-library-for-js/issues/407","id":422360295,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjM2MDI5NQ==","user":{"login":"ik1728","id":33411012,"node_id":"MDQ6VXNlcjMzNDExMDEy","avatar_url":"https://avatars3.githubusercontent.com/u/33411012?v=4","gravatar_id":"","url":"https://api.github.com/users/ik1728","html_url":"https://github.com/ik1728","followers_url":"https://api.github.com/users/ik1728/followers","following_url":"https://api.github.com/users/ik1728/following{/other_user}","gists_url":"https://api.github.com/users/ik1728/gists{/gist_id}","starred_url":"https://api.github.com/users/ik1728/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ik1728/subscriptions","organizations_url":"https://api.github.com/users/ik1728/orgs","repos_url":"https://api.github.com/users/ik1728/repos","events_url":"https://api.github.com/users/ik1728/events{/privacy}","received_events_url":"https://api.github.com/users/ik1728/received_events","type":"User","site_admin":false},"created_at":"2018-09-18T11:42:01Z","updated_at":"2018-09-18T11:42:01Z","author_association":"NONE","body":"Hi,\r\nCurrent version of MSAL-Angular is 0.1.2\r\nAngular Version : 6.1.6\r\n\r\nAcquiring of Access Token is working in DEV but Not in PROD.\r\n"}}
{"actor":{"display_login":"ik1728"}}