MsalContext accounts contains incorrect for authenticated user #7110
Labels
b2c
Related to Azure B2C library-specific issues
bug-unconfirmed
A reported bug that needs to be investigated and confirmed
msal-browser
Related to msal-browser package
msal-react
Related to @azure/msal-react
public-client
Issues regarding PublicClientApplications
question
Customer is asking for a clarification, use case or information.
Core Library
MSAL.js (@azure/msal-browser)
Core Library Version
3.14.0
Wrapper Library
MSAL React (@azure/msal-react)
Wrapper Library Version
2.0.16
Public or Confidential Client?
Public
Description
During app bootstrap msal is loaded and the msal context is initialized with
After you acquire a token, the account is updated in the msal instance, but the context is still returning the old object. This is due the fact that the context is not updated as the utility function
accountArraysAreEqual
skips this new value as it matches the old account based onhomeAccountId
,localAccountId
andusername
. My expectation is that this new account is reflected also in the msal context.Is there a reasoning why this behaves like this, or is this a bug?
Error Message
No response
MSAL Logs
No response
Network Trace (Preferrably Fiddler)
MSAL Configuration
Relevant Code Snippets
// none
Reproduction Steps
const { accounts, instance } = useMsal(); // accounts is different from instance.getAllAccounts()
Expected Behavior
accounts
in MsalContext properly reflect the result ofmsalInstance.getAllAccounts()
Identity Provider
Azure B2C Custom Policy
Browsers Affected (Select all that apply)
Chrome, Firefox, Edge, Safari
Regression
No response
Source
External (Customer)
The text was updated successfully, but these errors were encountered: