Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSAL JS should not throw user account switch error when home account ids of the request/response match #6846

Merged
merged 9 commits into from
Feb 13, 2024

Conversation

lalimasharda
Copy link
Contributor

@lalimasharda lalimasharda commented Jan 24, 2024

This PR fixes 2 issues:

  • When the parent app is requesting tokens on behalf of an iframed application, it should check request/response based on the native account id as well as the homeAccountId.
  • When the tokens are brokered, the parent's native account id should not be cached in the iframed application. The iframed application should only store it's own native account id.

@github-actions github-actions bot added the msal-browser Related to msal-browser package label Jan 24, 2024

if (
homeAccountIdentifier != cachedhomeAccountId &&
response.account.id !== request.accountId
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add the use cases in description of this PR where this is true that is, home account ID matches but account response differs and vice versa? I thought this was added to address the difference between embedded frame vs the parent frame in the request and am curious where this bug surfaced?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that's the main use case. Also, parent's native account id seemed to be getting passed on to the embeddd frame, so I have included a fix for that in this PR as well.

…t.ts

Co-authored-by: Thomas Norling <thomas.norling@microsoft.com>
@lalimasharda lalimasharda merged commit c6b5f3d into dev Feb 13, 2024
28 of 30 checks passed
@lalimasharda lalimasharda deleted the native_account_switch_error branch February 13, 2024 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
msal-browser Related to msal-browser package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants