I need help configuring authentication with Microsoft Entra External ID for my React frontend (using MSAL) and .NET Core Web API backend. I want to support multiple account types including organizational accounts, personal Microsoft accounts, and social logins like Google and Facebook.
Current backend configuration in appsettings.json:
{
"ClientApp": {
"AadApplicationId": "abc123de-45fg-67hi-89jk-lmnopqrst"
},
"Auth": {
"EntraId": {
"TenantId": "def456gh-78ij-90kl-12mn-opqrstuvw",
"Authority": "https://mycompany.ciamlogin.com/",
"ApiScope": "user_access",
"ApplicationId": "ghi789jk-01lm-23no-45pq-rstuvwxyz",
"ValidAudience": "ghi789jk-01lm-23no-45pq-rstuvwxyz"
},
"Provider": "EntraExternal"
}
}
Frontend receives this config from /api/auth-settings endpoint:
{
"provider": "EntraExternal",
"authority": "https://mycompany.ciamlogin.com/def456gh-78ij-90kl-12mn-opqrstuvw",
"clientId": "abc123de-45fg-67hi-89jk-lmnopqrst",
"scope": "api://ghi789jk-01lm-23no-45pq-rstuvwxyz/user_access"
}
React MSAL configuration:
const createMsalConfiguration = (config: AuthSettings): Configuration => ({
auth: {
clientId: config.clientId,
authority: config.authority,
redirectUri: window.location.origin,
},
})
// Usage
const msalApp = new PublicClientApplication(createMsalConfiguration(authSettings));
await msalApp.initialize();
Both applications are registered with account types set to support multitenant organizational directories and personal Microsoft accounts. I also enabled social identity providers in the External ID configuration.
My main questions:
- What specific settings or changes do I need to make this work with all account types (organizational, personal, social) in Entra External ID?
- Do I need special endpoints or policies configured in both the React app and API to handle this mixed authentication scenario?
Any help with the proper configuration would be awesome!