Microsoft-authentication-library-for-js: Multiple instances of MSAL

Created on 6 Sep 2019  路  7Comments  路  Source: AzureAD/microsoft-authentication-library-for-js

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[X] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

Browser:

  • [X] Chrome version ALL
  • [X] Firefox version ALL
  • [X] IE version ALL
  • [X] Edge version ALL
  • [X] Safari version ALL

Library version


Library version: All Versions

Current behavior


Currently MSAL creates a global instance in the window. As web applications move towards a more Micro Frontend architecture style where multiple parts of a page are essentially different independent applications, each with their own authentication requirements, this presents problems. With the current implementation of MSAL, it is not currently possible to have more then one MSAL instance. For example when one component of the page which using this architecture is its own app in and of itself, its client ID needs to be different then that of another or that of the host page, and the current implementation does not allow for this.

Expected behavior


MSAL should be able to create multiple instances on a single page so that Micro Frontend style architectures where multiple independent apps are running on the page are supported. Authentication can then be encapsulated within the applications, and not attached to the global context.

Minimal reproduction of the problem with instructions


Not Applicable

feature

All 7 comments

We are working on solving this, assigning to @sameerag who is leading that effort.

We are working on solving this, assigning to @sameerag who is leading that effort.

Do you have a timeline for it?

@villasante We are working on it currently, and are planning to include it in an upcoming release. We'll post here when it has shipped.

@shane7218 Will you be open to test our beta versions that consist this change? There should be an update in the next couple weeks on the same.

Absolutely, let me know whatever I can do to help!

Hi @shane7218, We have fixed this issue in MSAL JS 1.2.0-beta.3. Please try and let us know if you have any further issues.

Thanks,
Neha

@negoe I'm using the redirect flow, and I need 2 instances of UserAgentApplication, each with a different client Id. As soon as I add the second instance, everything breaks.

Looking at the PR that claims to fix this, it only seems to be targeting the popup flow. Are there any workarounds?

Was this page helpful?
0 / 5 - 0 ratings