buildFromWebView

fun buildFromWebView(onOpen: (ExternalBrowserMsaAuthService) -> Unit, onClose: (ExternalBrowserMsaAuthService) -> Unit, applicationConfig: MsaApplicationConfig = JAVA_APPLICATION_CONFIG, timeoutMs: Int = DEFAULT_TIMEOUT_MS): MicrosoftAccount

Signs in through a browser the caller supplies. Preferred over the other flows, as it supports 2FA, passkeys and everything else Microsoft offers.

onOpen has to display ExternalBrowserMsaAuthService.getAuthenticationUrl and report the URLs it navigates to back to the service; onClose runs once the sign-in has finished, failed or timed out.