microsoft-authentication-library-for-js: Node: AccountUserInfo.idTokenClaims is undefined when deserializing from cache

Library

  • @azure/msal-node@1.0.1

Framework

  • Electron

Description

I’m following the Msal Electron Node sample (link) and I would like to read the user roles (authProvider.currentAccount.idTokenClaims.roles) but idTokenClaims is always undefined, even if I do have the object properly populated with the roles array after doing the login and before serializing it and saving it into the cache file. It seems like the Serializer (link) does not include information about idTokenClaims.roles, or I might be missing something regarding how (if possible) to get this information based on what is serialized inside the IdToken object.

Error Message

MSAL Configuration

Reproduction steps

Try to obtain information about the user roles authProvider.currentAccount.idTokenClaims.roles.

Expected behavior

User roles information should be exposed via idTokenClaims.roles

Identity Provider

  • Azure AD
  • Azure B2C Basic Policy
  • Azure B2C Custom Policy
  • ADFS
  • Other

Browsers/Environment

  • Chrome
  • Firefox
  • Edge
  • Safari
  • IE
  • Other (Electron)

Regression

  • Did this behavior work before? Version:

Security

  • Is this issue security related?

Source

  • Customer request

About this issue

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

Most upvoted comments

Is it foreseeable when this bug will be fixed? Currently the ID token claims are completely empty when deserializing from the cache. This requires a messy workaround and you have to persist the claims yourself elsewhere.

Thank you so much!