Is there a way to only authenticate users for my app that have been applied a specific role? I'm using React, Express, Node, Postgres DB.
We have many members in our Active Directory, but only want to allow users that have been given one of three roles to be able to be authenticated/logged in.
Is this something I achieve by a custom scope somehow, or is there another way to check roles before they are authenticated/logged in?
Here is my basic code for MSAL.
const config = {
auth: {
clientId: 'xxxxxx',
authority: 'https://login.microsoftonline.com/xxxxxxx',
redirectUri: '/'
},
cache: {
cacheLocation: "sessionStorage", // This configures where your cache will be stored
storeAuthStateInCookie: false, // Set this to "true" if you are having issues on IE11 or Edge
}
};
const pca = new PublicClientApplication(config);
pca.addEventCallback(event => {
if(event.eventType === EventType.LOGIN_SUCCESS)
if(event){
console.log(event)
pca.setActiveAccount(event.payload.account);
}
});
Thanks!