-
Notifications
You must be signed in to change notification settings - Fork 30
Get-MsalToken fails to launch interactive authentication prompt from Windows Terminal #58
Comments
I forgot to mention I'm using the latest version of |
I'm also able to repro this issue, interestingly this only seems to occur if you launch Windows PowerShell from the start menu AND have Default terminal application set to Windows Terminal within it's settings. If I just launch Windows Terminal first, it doesn't seem to care what it's set to. Also, to @yitzhaks point you can also just set the default terminal application to Windows console host as a workaround. I notice that the process chain in Task Manager differs depending on how you launch:
Seems like Windows Terminal isn't tying the Windows PowerShell process to it's parent properly when you launch it that way and chains it as a child of Explorer.exe. Therefore I guess a 3rd (albeit ugly) workaround would be to check if the parent process of Windows PowerShell is Explorer.exe and isn't running with conhost, then if that occurs relaunch under different conditions. I'm not quite sure how exactly to define the root of this issue but it feels like it should be resolved on the Windows Terminal side rather than this specific module. I'd be happy to open an issue over there with a bit of assistance to more accurately define this. I suppose it's also possible that this isn't unique to this module and needs to be resolved in the actual MSAL. I'm not noticing anything glaring in the MSAL.PS module itself. |
Seems like this is failing because of this code in Get-MsalToken.ps1
It is getting the window of the parent process, and with that's explorer.exe. |
I am using Windows Terminal Preview (v1.16.2524.0) as my default terminal application.
When running Windows PowerShell from Terminal, I'm unable to interactively authenticate.
When running
Get-MsalToken
I get the below error:When running the same flow from Windows PowerShell hosted by conhost.exe,
Get-MsalToken
is able to successfully open the interactive logic pop-up.The text was updated successfully, but these errors were encountered: