A cloud-based identity and access management service for securing user authentication and resource access
Use MSAL Node with authorization-code flow plus PKCE and perform interactive Entra authentication in the Windows system browser; do not depend on removing Electron/ from the User-Agent.
What the A/B test establishes
Your result strongly indicates that Entra’s server-side client classification changes when the outgoing header contains Electron/. It also explains why identical navigator.userAgent values do not produce identical results: JavaScript sees the renderer value, while login.microsoftonline.com makes decisions from the HTTP request and other request context.
However, the public documentation does not specify:
- An intentional rule that suppresses passkeys whenever
Electron/is present. - Whether matching is based only on
Electron/, the full product/version token, another application token, or multiple signals. - A supported User-Agent override that makes Electron an officially supported Chrome client.
Consequently, the exact heuristic—and whether the observed behavior is intentional or an implementation detail—cannot be confirmed publicly.
The published Windows browser matrix lists Chrome, Edge, and Firefox, but not Electron or generic Chromium embeddings.^1^ A successful WebAuthn capability check or webauthn.io test proves that the embedded Chromium surface can perform WebAuthn; it does not establish that Entra classifies that surface as a supported browser.
Recommended desktop architecture
For Windows applications, Microsoft recommends these options in order:
- Windows Authentication Manager (WAM) for supported .NET/MSAL desktop applications.
- WebView2 when FIDO2 must remain embedded.
- The system browser, which is the normal fallback for desktop MSAL applications.^2^
For an Electron application, the practical supported direction is:
- Register the application as a Mobile and desktop application.
- Configure
http://localhostas its redirect URI. - Use MSAL Node, not MSAL Browser, for the native desktop authentication flow.
- Generate an authorization URL using authorization-code flow with PKCE.
- Open that URL in the user’s default browser.
- Receive the redirect on a loopback listener and redeem the authorization code through MSAL Node.
- Return the resulting account/session state to the Electron renderer.
Microsoft’s Electron tutorial specifically uses MSAL Node, authorization-code flow with PKCE, and a desktop http://localhost redirect; it also states that MSAL Browser is not supported for Electron applications.^3^ MSAL Node’s documented flow is to create the authorization URL, let the user open it in a browser, and then pass the returned code to acquireTokenByCode().^4^
At a high level, the Electron handoff looks like this:
const { shell } = require("electron");
// authProvider starts a localhost listener and creates
// an MSAL Node authorization URL containing PKCE parameters.
const authorizationUrl = await authProvider.getAuthorizationUrl();
await shell.openExternal(authorizationUrl);
// The localhost callback supplies the authorization code;
// MSAL Node validates state and redeems it with the PKCE verifier.
const result = await authProvider.waitForRedirectAndAcquireToken();
Use MSAL’s state, nonce, PKCE, token-cache, and code-redemption functionality rather than implementing the protocol manually. Microsoft recommends supported authentication libraries instead of manually issuing raw OAuth requests.^5^
Should the User-Agent be rewritten?
Treat the rewrite as a diagnostic result, not a production solution:
- It causes Entra to classify an Electron surface as another browser without making the surface equivalent to that browser.
- The matching behavior is undocumented and can change independently of Electron or Chromium.
- Other authentication stages, Conditional Access checks, or future passkey behavior could classify the client differently.
If keeping authentication embedded is mandatory on Windows, evaluate WebView2, which Microsoft documents as supporting FIDO and Windows Hello.^6^ Otherwise, the system-browser/MSAL Node design is the appropriate Electron path.
To obtain an authoritative answer about the exact Electron/ or app-token matching rule, open a Microsoft support case with the tenant, correlation ID, UTC timestamp, Electron/Chromium versions, and sanitized A/B description. Do not include authorization codes, tokens, cookies, or passkey artifacts.
References
- Passkey (FIDO2) authentication matrix with Microsoft Entra ID
- Support passwordless authentication with FIDO2 keys in apps you develop
- Tutorial: Sign in users and call the Microsoft Graph API in an Electron ...
- Desktop app that calls web APIs: Acquire a token interactively
- Microsoft identity platform and OAuth 2.0 authorization code flow
- Acquiring tokens interactively