Curious if anyone has used MSALjs with RequireJS. I seem to be stuck getting the exports to register correctly. I can see the msal.js file is loaded in both the Visual Studio IDE and the Chrome Sources. The project using RequireJS 2.3.6 and MSAL 1.1.3.
require.config.js
var require = {
baseUrl: "/",
paths: {
.....
"msal": "https://alcdn.msauth.net/lib/1.1.3/js/msal"
}
};
main.js
require([
.....
, 'msal'
], function (
.....
, msal
) {
var _Msal = new Msal; //Msal is not defined
....
});
Any help would be really appreciated. I've been stuck on this for a couple days now.
This is how it should read. Thank you jasonnutter!
require.config.js
var require = {
baseUrl: "/",
paths: {
.....
"Msal": "https://alcdn.msauth.net/lib/1.1.3/js/msal"
}
};
main.js
require([
.....
, 'Msal'
], function (
.....
, Msal
) {
var msalConfig = {
auth: {
clientId: "obfuscated_clientid",
authority: "https://login.microsoftonline.com/common",
redirectURI: "http://localhost:58541/"
},
cache: {
cacheLocation: "localStorage",
storeAuthStateInCookie: true
}
};
const MsalAgent = new Msal.UserAgentApplication(msalConfig);
....
});
Can you try "Msal"
, instead of "msal"
?