question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Node: AccountUserInfo.idTokenClaims is undefined when deserializing from cache

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Philluxxcommented, Nov 3, 2021

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!

0reactions
sameeragcommented, Apr 2, 2022

#4081 is merged now. Closing this issue. Please test and raise another issue if you are still seeing this problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Learn about Microsoft Authentication Extensions for Node
The Microsoft Authentication Extensions for Node enables application developers to perform cross-platform token cache serialization and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found