I have problem with get token when log in with Azure Active Directory using msal.js.
Maybe I'll describe you how the app works in several situations.
I. Automatic login with Active Directory Authentication is disabled. Callback on Application Registration Portal is set to home page of the app. I used the code from https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/devApps/VanillaJSTestApp/index_LoginPopup.html
- Enter the app without authorization
- Click on button which runs loginPopup, after log in get token.
Everything works, but I want authorization with Active Directory Authentication
II. Automatic login with Active Directory Authentication is enabled. Callback on Application Registration Portal is set to "***.auth/login/aad/callback". I used the code from https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/devApps/VanillaJSTestApp/index_LoginPopup.html
- Enter the app with authorization and log in with Active Directory Authentication
- acquireTokenSilent is sending error like "user_login_error:User login is required".
- Click on button which runs loginPopup, after log in I get error like "The reply address **** does not match the reply addresses configured for the application"
UPDATE: After set userAgentApplication.redirectUri = '****/.auth/login/aad/callback' and run loginPopup, token is delivered, but it's still double log in.
To summarize, after login with Azure I get error from acquireTokenSilent "user_login_error:User login is required".
III. I would like the app to behave as follows:
- Enter the app with authorization and log in with Active Directory Authentication
- Get token
Can I do it like this?
You were mixing the Easy Auth and protecting the site manually using MSAL.
If you want the popup page for login with Azure Active Directory popup automatically, you can modify the source to add the function to execute the
loginPopup()method when the document is loaded completely. Here is an code sample for your reference: