-
Notifications
You must be signed in to change notification settings - Fork 2.7k
AccountInfo.username is no longer populated for Azure B2C token #8205
Copy link
Copy link
Open
Labels
Needs: Attention 👋Awaiting response from the MSAL.js teamAwaiting response from the MSAL.js teamb2cRelated to Azure B2C library-specific issuesRelated to Azure B2C library-specific issuesbug-unconfirmedA reported bug that needs to be investigated and confirmedA reported bug that needs to be investigated and confirmedmsal-browserRelated to msal-browser packageRelated to msal-browser packagemsal-reactRelated to @azure/msal-reactRelated to @azure/msal-reactpublic-clientIssues regarding PublicClientApplicationsIssues regarding PublicClientApplicationsquestionCustomer is asking for a clarification, use case or information.Customer is asking for a clarification, use case or information.
Metadata
Metadata
Assignees
Labels
Needs: Attention 👋Awaiting response from the MSAL.js teamAwaiting response from the MSAL.js teamb2cRelated to Azure B2C library-specific issuesRelated to Azure B2C library-specific issuesbug-unconfirmedA reported bug that needs to be investigated and confirmedA reported bug that needs to be investigated and confirmedmsal-browserRelated to msal-browser packageRelated to msal-browser packagemsal-reactRelated to @azure/msal-reactRelated to @azure/msal-reactpublic-clientIssues regarding PublicClientApplicationsIssues regarding PublicClientApplicationsquestionCustomer is asking for a clarification, use case or information.Customer is asking for a clarification, use case or information.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Core Library
MSAL.js (@azure/msal-browser)
Core Library Version
4.27.0
Wrapper Library
MSAL React (@azure/msal-react)
Wrapper Library Version
3.0.23
Public or Confidential Client?
Public
Description
The
usernameproperty is no longer provided inAccountInfofor Azure B2C token.I traced the problem to release 4.19.0. This was working in
4.18.0.Here is the relevant react code:
Here is a sample of the
idTokenfrom Azure B2C{ "alg": "RS256", "kid": "<redacted>", "typ": "JWT" }.{ "exp": 1765830198, "nbf": 1765826598, "ver": "1.0", "iss": "https://<redacted>.b2clogin.com/<redacted>/v2.0/", "sub": "9ea8c064-<redacted>", "aud": "3740edc9-<redacted>", "nonce": "019b2377-66b7-7953-b4aa-e8c748cdfa54", "iat": 1765826598, "auth_time": 1765826596, "oid": "9ea8c064-<redacted>", "emails": [ "myemail@domain.com" ], "tfp": "B2C_1_SignUpSignIn" }.[Signature]I can workaround the problem by pulling the username from the
emailsclaim.Maybe the behavior in
4.18.0whereusernameis populated from this type of token was not supported? I'm confused because I didn't expect breaking changes in a minor release.Error Message
No response
MSAL Logs
No response
Network Trace (Preferrably Fiddler)
MSAL Configuration
Relevant Code Snippets
Reproduction Steps
idTokenfrom Azure B2C using a standard "sign-up-sign-in" flowuseMsal()to get an instanceIPublicClientApplicationinstanceusernameproperty on the returnedAccountInfoExpected Behavior
Expected:
usernameproperty populated withe the email address for the Azure B2C user. This is the observed behavior in4.18.0Identity Provider
Azure B2C Basic Policy
Browsers Affected (Select all that apply)
Firefox
Regression
@azure/msal-browser 4.18.0