microsoft-authentication-library-for-js: idTokenClaims is undefined when refresh the browser in angular 16

Core Library

MSAL.js (@azure/msal-browser)

Core Library Version

^3.1.0

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

^3.0.4

Public or Confidential Client?

Public

Description

When i refresh the browser idTokenClaims is undefined,

with below version “@azure/msal-angular”: “^3.0.4”, “@azure/msal-browser”: “^3.1.0”,

however it is working fine with below version. (just removed the ^) “@azure/msal-angular”: “3.0.4”, “@azure/msal-browser”: “3.1.0”,

Please help us to find the root cause for this issue

Error Message

idTokenClaims is undefined

Msal Logs

No response

MSAL Configuration

default

Relevant Code Snippets

"@azure/msal-angular": "^3.0.4",
    "@azure/msal-browser": "^3.1.0",

Reproduction Steps

"@azure/msal-angular": "^3.0.4",
"@azure/msal-browser": "^3.1.0",

Expected Behavior

it should work with below version with ^ added in the version “@azure/msal-angular”: “^3.0.4”, “@azure/msal-browser”: “^3.1.0”,

Identity Provider

Azure B2C Basic Policy

Browsers Affected (Select all that apply)

Chrome

Regression

No response

Source

External (Customer)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

@danvod removing https:// from knownAuthorities solved our issue, but in your example you already use it without https. This is what our configuration looked like before:

const msalConfig = {
  auth: {
    clientId: "<your-clientID>",
    authority: "https://<your-tenant>.b2clogin.com/<your-tenant>.onmicrosoft.com/<your-policyID>",
    knownAuthorities: ["https://<your-tenant>.b2clogin.com"] 
  }
}

and changing it to

const msalConfig = {
  auth: {
    clientId: "<your-clientID>",
    authority: "https://<your-tenant>.b2clogin.com/<your-tenant>.onmicrosoft.com/<your-policyID>",
    knownAuthorities: ["<your-tenant>.b2clogin.com"] 
  }
}

solved our issue

@gauert-dasgip, this helped a lot! It seems my error was different.

My tenant is “Mytenant123.b2clogin.com,” which I copied from the Azure portal and haven’t given much thought. That did not work; however, “mytenant123.b2clogin.com” did, so there we go. Thanks again, have a good day!