I am trying with MSAL (@azure/msal-angular) for Azure Signin and new to angular .I need to get username after logged in and display it in UI.Thanks in advance
I am trying with MSAL (@azure/msal-angular) for Azure Signin and new to angular .I need to get username after logged in and display it in UI.Thanks in advance
You could use myMSALObj.getAccount().userName to get userName.
function showWelcomeMessage() {
var divWelcome = document.getElementById('WelcomeMessage');
divWelcome.innerHTML = 'Welcome ' + myMSALObj.getAccount().userName + " to Microsoft Graph API";
var loginbutton = document.getElementById('SignIn');
loginbutton.innerHTML = 'Sign Out';
loginbutton.setAttribute('onclick', 'signOut();');
}
For more details, see here.