AzureAD / azure-activedirectory-library-for-js

The code for ADAL.js and ADAL Angular has been moved to the MSAL.js repo. Please open any issues or PRs at the link below.
https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/maintenance/adal-angular
Apache License 2.0
627 stars 374 forks source link

Singleton behavior is confusing #827

Closed sliekens closed 4 years ago

sliekens commented 5 years ago

I just found out that new AuthenticationContext doesn't actually create new instances after the first time it's used.

const a = new AuthenticationContext({
    clientId: 'A'
});

const b = new AuthenticationContext({
    clientId: 'B'
});

// next assertion fails
expect(Object.is(a, b)).toBe(false); 

This should be documented here: https://github.com/AzureAD/azure-activedirectory-library-for-js/wiki/Config-authentication-context#authenticationcontext

It's important to mention that the constructor ignores the options argument when called more than once.