Single sign-on with MSAL.js?
Use acquireTokenSilent instead of loginPopup, and pass your client ID as the scope. If the promise is rejected, then you need to call one of the other functions to log in.
If specify the tenant and only one user is signed into azure ad before , you could directly sign into your app if prompt=none
(by default) . You can't achieve that with MSAL.JS , refer to source code of MSAL.JS :
var urlNavigate = authenticationRequest.createNavigateUrl(scopes) + "&prompt=select_account" + "&response_mode=fragment";
It will set prompt=select_account
will redirect user to select account page . If you are using Azure AD accounts and just want to login a specific tenant , you could try ADAL.JS (will not force prompt=select_account). If that is a multi-tenant app(use common
instead of tenant id ) , you can't avoid user selecting page with azure ad v2.0 endpoint .
Notice :If the user is signed into azure ad with multiple accounts , you can't avoid user selecting page , that is by design , user should has the opportunity to choose which account he or she wants to use for signing into the application .