
9,641 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello, when using the following code
const msalConfig = {
auth: {
clientId: '@Model.M365ClientId',
authority: '@Model.Authority'
},
cache: {
cacheLocation: "localStorage",
storeAuthStateInCookie: true,
secureCookies: true
}
};
const msalInstance = new msal.PublicClientApplication(msalConfig);
var loginRequest = {
scopes: ["user.read", "offline_access"],
prompt: 'select_account',
redirectUri: window.location.origin + '/blank.html'
};
try {
await msalInstance.initialize();
await msalInstance.handleRedirectPromise();
const loginResponse = await msalInstance.loginPopup(loginRequest);
to open up a M365 Azure AD login popup I am getting the following error in the last line of the code above. Javascript code is being executed from a .js file.
login.js:80 TypeError: Failed to construct 'URL': Invalid URL
at Qi (msal-browser-3.9.0.min.js:68:17534)
at ga.acquireTokenPopupAsync (msal-browser-3.9.0.min.js:68:92392)
at async HTMLButtonElement.login365 (login.js:55:31)
If I move the code from the .js file to an inline script, the auth popup is correctly displayed and I can login into my application. How can I solve this? I don't want to use an inline script. Thanks, Miguel
Hello,
Can anyone reply to this question?
Thanks