alflokken / PSAuthClient

PowerShell OAuth2.0/OpenID Connect (OIDC) Client.
MIT License
51 stars 7 forks source link

"Authorization code workflow" webview launches but does not show anything #4

Open TuxPowered42 opened 2 months ago

TuxPowered42 commented 2 months ago

Hello,

I'm trying to use this module to authenticate with Microsoft Entra. The "Authorization code workflow" window pops-up but it contents remains a blank page. I've checked with Wireshark and it seems no outbound traffic is being generated at all.

Invoke-OAuth2AuthorizationEndpoint `
-uri "https://login.microsoftonline.com/<TENANT ID>/oauth2/v2.0/authorize" `
-client_id "<APPLICATION ID>" `
-scope "User.read offline_access openid profile" `
-redirect_uri "https://<APPLICATION REAL URL>"

When run with additional -Verbose it produces this output:

VERBOSE: Invoke-OAuth2AuthorizationRequest OIDC request uri
https://login.microsoftonline.com/<TENANT ID>/oauth2/v2.0/authorize?response_type=code&client_
id=<APPLICATION ID>&state=<SOME STRING>&redirect_uri=https%3a%2f%2f<APPLICATION REAL URL>&scope=User.read+offline_access+openid+profile&nonce=<SOME STRING>&code_challenge=<SOME STRING>&code_challenge_method=S256

This URL pasted into Edge properly opens the Microsoft's login page.

When I close the WebView window manually, an exception is thrown in line 517:

else { throw "invalid response received" }
alflokken commented 1 month ago

Are you running Windows 10 by any chance? Could you try installing the WebView2 Runtime and see if this resolves your issue? (Select "Evergreen Standalone Installer" (MicrosoftEdgeWebView2RuntimeInstallerX64.exe))

TuxPowered42 commented 1 month ago

This is on Windows 11 ARM running in a VM in Parallels on M1 MacBook Pro. Trying to install the WebView2 from the URL from your post results in an error saying that WebView2 is already installed.

alflokken commented 1 month ago

Thank you for reporting the issue. I've made some changes to the code to include WebView2 runtimes for ARM. Unfortunately, I don't have an ARM device to test it myself.

Could you please test this build and let me know if it resolves the issue?