0
votes

Because of MSAL.js v1.x reliance on 3rd party cookies, I want to move my SPA to MSAL.js 2.0.

This migration document outlines how this can be achieved.

The problem is that it doesn't work when I use the same authority that I used with the Sign up and sign in User Flow. That authority worked for MSAL.js.

Is there any example or some guidelines on how to use MSAL.js 2.0 with the "Sign up and sign in" User flow?


This is the error that I get:

enter image description here


Basically I would like to achieve the same thing as in

https://github.com/Azure-Samples/active-directory-b2c-javascript-msal-singlepageapp

but using Msal.js v2.0

1
What do you mean when you say it doesn't work?juunas
Are you using the new b2clogin.com URLs? Also, MSAL 2.0 uses Auth Code flow and not the Implicit Grant. So make sure you have that activated in your B2C settings tooCeros
@juunas: Sorry for the ambiguous question, I added more details now.Copil tembel
@Ceros: Yes, I am using the new b2clogin.com URLs. And yes, I have activated the Auth Code flow in my B2C settings.Copil tembel
Can you check what URL it is trying to access for the metadata document? You should be able to see it in your F12 tools.juunas

1 Answers

0
votes

I was receiving this error as I had the wrong knownAuthorities property. It should not have contained https://.

Example config

auth: {
    clientId: "YOUR_CLIENT_ID",
    authority: "https://<tenant>.b2clogin.com/<tenant>.onmicrosoft.com/<policy>",
    knownAuthorities: ["<tenant>.b2clogin.com"],
    redirectUri: "",
    postLogoutRedirectUri: ""
  }