Closed profteck closed 3 years ago
@profteck this is a known issue and a fix will be coming with the new release. For now, please downgrade to a previous version.
What I've done is create a brand new project. I've copied the ts / html / css files from your sample project. I'm fairly new to angular!!
This is how I tried to use an earlier version
npm install @azure/msal-angular@2.0.0-beta.3 (installs ok)
npm install @azure/msal-browser@2.13.1 (not found when I try to install)
So what I then tried is:
In the package.json file I've copied in this dependencies from the sample project. "@azure/msal-angular": "^2.0.0-beta.3", "@azure/msal-browser": "^2.13.1", "core-js": "^3.8.0",
Then I use "npm install" to install any missing packages.
But I'm still getting the same error.
The only way I can get my project to work is to replace the node_modules folder from the sample project and it will then work.
But if I do an "npm install" again it goes back to the original error (which is not ideal).
I know I'm missing something. Any ideas?
Thanks
@profteck no worries! here's how you should approach (no need to copy paste files):
node_modules
folder and package-lock.json
filenpm cache clean --force
package.json
as to have:"@azure/msal-angular": "^2.0.0-beta.3",
"@azure/msal-browser": "^2.13.1",
npm install
againThe alternative approach could be to apply the temporary fix mentioned here. I'm assuming you are using sample 1.2)sign-in-b2c. There, modify app.module.ts like:
export function MSALGuardConfigFactory(): MsalGuardConfiguration {
return {
interactionType: InteractionType.Redirect,
authRequest: [ "CLIENT_ID_OF_YOUR_APP" ]
};
}
Apologies for the trouble. This will be fixed as soon as the new version releases.
Hi
thank you for replying.
I've tried the first option but still get the error.
The link to the work around is broken.
For the moment - I'm copying the node_modules folder from your sample and then installing any library I need - not using the full npm install and that works.
Thanks Ann
@profteck apologies, here's the correct link for the workaround
@profteck a new version msal-browser and msal-angular just released. This should fix the issue, can you update your packages to the latest and give it a try again?
Hi
I tried that and yes, the error that I was having has gone. One thing I have noticed - I'm using your sample project - "ms-identity-javascript-angular-tutorial-main\3-Authorization-II\2-call-api-b2c\SPA". Before you log in, you get this screen:
After you log in - it used to display the following automatically:
After the update, the page has to be refreshed before this appears.
I've noticed that the claim that is returned is a different format. This was the old format - I added a Console.log to the method - getClaims()
getClaims(claims: any) {
this.dataSource = [
{id: 1, claim: "Display Name", value: claims ? claims['name'] : null},
{id: 2, claim: "Object ID", value: claims ? claims['oid']: null},
{id: 3, claim: "Job Title", value: claims ? claims['jobTitle']: null},
{id: 4, claim: "City", value: claims ? claims['city']: null},
];
console.log(claims);
}
.
On the latest update the claims output looks like this:
Maybe there is an update required on the sample project?
Thanks for all your help.
Ann
@profteck thanks for catching this! Will get this fixed in PR asap.
Thanks a mill. Your samples really do help me to understand the concepts.
This issue is for a: (mark with an
x
)Minimal steps to reproduce
Click Login In Button and log in - F12 and look at console window - it has an error when trying to get the claims.
Any log messages given by the failure
Expected/desired behavior
Browser and version?
Versions
Mention any other details that might be useful