mirror of
https://github.com/Micke-K/IntuneManagement.git
synced 2026-11-27 09:22:26 +01:00
Consent prompt: honour "Use System Browser for login"
Start-MSALConsentPrompt built its own interactive request without the WithUseEmbeddedWebView($false) that Connect-MSALUser applies when the setting is on, so Request Consent opened the embedded window: no access to the browser session (it asked for a new sign-in) and no passkey / FIDO2 support. It now makes the same browser choice as the login. Reported in discussion #439. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fb819949f5
commit
75c28c83e5
@@ -1512,6 +1512,15 @@ function Start-MSALConsentPrompt
|
|||||||
[void]$aquireTokenObj.WithParentActivityOrWindow($ParentWindow)
|
[void]$aquireTokenObj.WithParentActivityOrWindow($ParentWindow)
|
||||||
}
|
}
|
||||||
[void]$aquireTokenObj.WithPrompt([Microsoft.Identity.Client.Prompt]::NoPrompt)
|
[void]$aquireTokenObj.WithPrompt([Microsoft.Identity.Client.Prompt]::NoPrompt)
|
||||||
|
|
||||||
|
# Same browser choice as the login (Connect-MSALUser): without this the consent
|
||||||
|
# prompt fell back to the embedded window, which has no access to the browser
|
||||||
|
# session (so it asked for a new sign-in) and cannot use passkeys or FIDO2 keys.
|
||||||
|
if($script:MSALUseSystemBrowser)
|
||||||
|
{
|
||||||
|
try { [void]$aquireTokenObj.WithUseEmbeddedWebView($false) }
|
||||||
|
catch { Write-LogDebug "WithUseEmbeddedWebView unavailable: $($_.Exception.Message)" }
|
||||||
|
}
|
||||||
|
|
||||||
Write-Log "Consent prompt for the following scopes: $(($script:missingPermissions -join ","))"
|
Write-Log "Consent prompt for the following scopes: $(($script:missingPermissions -join ","))"
|
||||||
[void] $aquireTokenObj.WithExtraScopesToConsent(([string[]]$script:missingPermissions))
|
[void] $aquireTokenObj.WithExtraScopesToConsent(([string[]]$script:missingPermissions))
|
||||||
|
|||||||
Reference in New Issue
Block a user