Comments (16)
This guy forked the repo and added all major module implementations, take a look at:
https://github.com/malekpour/microsoft-authentication-library-for-js
from microsoft-authentication-library-for-js.
I'm not sure why this isn't the default behavior.
from microsoft-authentication-library-for-js.
Any news on this?
from microsoft-authentication-library-for-js.
To my understanding, most es6 features should be available in IE11 with one or more polyfills (such as Babel). You already do this to support promises.
It's strange to me that the new version of the JavaScript auth library requires jumping through more hoops to be used with modern JavaScript frameworks than the ADAL v1 library does.
Is it at least possible to register a second npm package that's built for ES6 by default?
from microsoft-authentication-library-for-js.
from microsoft-authentication-library-for-js.
Feature is now added to dev and will be part of our next release early next week. Closing this issue for now. Please reopen if you still face issues.
from microsoft-authentication-library-for-js.
@TulyOpt : if you clone the repo and change in es5 to es6 here: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/master/tsconfig.base.json#L7, you would generate msal for es6. Would that work for you?
from microsoft-authentication-library-for-js.
Hi,
thanks for your answer, i will try this.
from microsoft-authentication-library-for-js.
from microsoft-authentication-library-for-js.
I believe that es5 is needed so that msal.js can be used with IE: See https://github.com/AzureAD/microsoft-authentication-library-for-js/wiki/Using-msal.js-with-Internet-Explorer.
Do you have ways to run es6 JavaScript with IE?
from microsoft-authentication-library-for-js.
Modules don't have the same polyfill-ability as other ESNext features. That said, it should be possible with the right npm configuration to publish both the transpiled ESNext code and the built files. This is what we do with momentjs. All that being said, I'm not sure how that interacts with the typescript here - that's not a space I have a lot of expertise in. I think that @DanielRosenwasser, @bterlson, or @TheLarkInn would be able to clarify on that if they're available.
Happy to contribute back the ESNext changes if you're comfortable with that.
from microsoft-authentication-library-for-js.
TypeScript will compile standard ES6 modules into a format consumable by IE11. There are other tools that can do this as well. I am also willing to help update this if I am needed.
from microsoft-authentication-library-for-js.
There is more than one way to deal with this problem:
- Set the
module
compiler option toumd
instead ofamd
. TypeScript will produce a universal module which should work both with Node and browsers. - Have another tsconfig which has
module
set tocommonjs
. Ship both amd and commonjs files to NPM. Configure package.json to point to the commonjs version:"main": "./out/msal.common.js"
,
from microsoft-authentication-library-for-js.
@TulyOpt @jmprieur @maggiepint @akorchev @bterlson @pdimitratos @cesarvarela @DibranMulder @VSDekar I have generated both commonjs and es-6 modules for msal in this branch as you can see in the "lib-commonjs" and "lib-es6" folder. In addition to that, we will ship a UMD bundle that will expose "Msal" as the global variable in the browser located in the 'dist" folder. Since it is not shipped to npm yet, you cannot just use npm install msal and get these yet. For testing though, you can generate a folder named msal in the node_modules folder of your app and clone the repo inside it. You will then be able to use statements like import {UserAgentApplication} from "msal". I have created a test app to test this using what I explained above: Please refer to https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/rohitnarula7176/modules/devApps/ModuleSample/src/components/index.tsx. Can you all please use it and confirm if that solves your issue.
from microsoft-authentication-library-for-js.
@TulyOpt @jmprieur @maggiepint @akorchev @bterlson @pdimitratos @cesarvarela @DibranMulder @VSDekar I have also published a beta version on npm which you can install using npm install [email protected]. You would then be able to import msal using es-6 and commonjs syntax. We will release an official version after testing.
from microsoft-authentication-library-for-js.
@jmprieur, just a comment about your previous sentence and IE support. It's possible to write es5 code that works fine in every situation: direct file download (using script element), module export and AMD definitions. This used to be a quite common technique for libraries. Something like:
;(function(factory) {
if (typeof module !== "undefined" && module.exports) {
// Node/CommonJS
module.exports = factory(this);
} else if (typeof define === "function" && define.amd) {
// AMD
var global=this;
define("LIBRARY_NAME", function(){ return factory(global);});
} else {
// Browser globals
this.LIBRARY_NAME = factory(this);
}
}(function(global) {
var LIBRARY_NAME = {};
return LIBRARY_NAME;
}));
This would have saved some headaches. I hit this wall when trying to use msal.js in a Vue.js project, now I am going to try with last update mentioned in last comment.
from microsoft-authentication-library-for-js.
Related Issues (20)
- LoginPopup and LoginRedirect not Working HOT 2
- ManagedIdentityTokenResponse's expires_in is not calculated correctly
- Managed Identity - add logs showing which MSI implementations were tried and why they are not available HOT 1
- Managed Identity - failed network request returns wrong error type
- MSAL 3.0 not returning accounts in Angular 17 after upgrading from 2.16.0 HOT 2
- Angular 17 Standalone MSAL Angular v3 Sample Doesnt work and Documentation is wrong HOT 1
- msal browser sample VanillaJSTestApp2.0 fails with ADFS HOT 2
- MsalContext accounts contains incorrect for authenticated user HOT 1
- The MSAL Interceptor finds invalid resources from the endpoint if another match is found in "QueryString". HOT 2
- sample fails at npm start: Angular 16 MSAL Angular v3 Sample: Cannot find module '@azure/msal-browser' HOT 2
- Error: Uncaught (in promise): InteractionRequiredAuthError: interaction_required: AADB2C90077: User does not have an existing session and request prompt parameter has a value of 'None'. HOT 2
- [Supportability Bug] Deprecate WithClientAssertion(string) as it leads to assertion expiration issues HOT 1
- sample "Angular 16 MSAL Angular v3 Sample" configured for ADFS logs event "msal:loginFailure" HOT 3
- sample "Angular 17 Standalone MSAL Angular v3 Sample" fails to build: Cannot set properties of null (setting 'parent'), Lifecycle script `postinstall:msal-angular` failed, etc.
- Custom state leads to error after upgrading to 3.14.0
- Support for Angular 18 HOT 1
- Issue with Password Reset Redirect Loop in MSAL Browser for B2C Users
- Getting AADB2C90079 after B2C login portal returns to app HOT 1
- Angular SSR support
- Improve exception messages for loadExternalTokens
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from microsoft-authentication-library-for-js.