Check for xdg-open availability on Linux for browser auth #2254
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Check for browser launcher availability (xdg-open, gnome-open, etc.) in addition to checking for desktop session presence to gate web auth flow.
Problem
GCM currently only checks for
DISPLAYorWAYLAND_DISPLAYenvironment variables to determine if browser-based authentication is available on Linux. However, MSAL checks forxdg-openavailability in addition to display environment variables. This creates a mismatch where GCM reports "browser not available" even though MSAL can successfully launch a browser usingxdg-open.Real-World BLocker: WaveSpace VMs
This fix isimportant for WaveSpace VMs and similar environments where:
DISPLAYenvironment variable)xdg-openis available and can launch the host system's browser (this is setup by VSCode remote tunnels)Solution
Modified
LinuxSessionManager.GetWebBrowserAvailable()to returntrueif:DISPLAY/WAYLAND_DISPLAY), ORxdg-openis available (new behavior)This matches MSAL's browser detection logic and ensures GCM, AzureAuth and MSAL behave consistently.
Behavior Changes
Testing
🤖 Generated with Claude Code