Skip to content

fix(auth): SAML login option + WSL browser open#1327

Draft
shreem26 wants to merge 2 commits into
BlazeUp-AI:mainfrom
shreem26:fix/auth-login-improvements
Draft

fix(auth): SAML login option + WSL browser open#1327
shreem26 wants to merge 2 commits into
BlazeUp-AI:mainfrom
shreem26:fix/auth-login-improvements

Conversation

@shreem26
Copy link
Copy Markdown
Contributor

@shreem26 shreem26 commented Jun 1, 2026

Purpose

Fix two issues with observal auth login:

  1. SAML SSO option never appears even when SAML is configured on the server
  2. Browser open prints gio: Operation not supported error on WSL

Approach

Fix 1: SAML login option missing

Problem: The login menu only showed 2 options (email/password + browser SSO) regardless of server SAML configuration. The saml_enabled field returned by GET /api/v1/config/public was never read by the CLI.

Fix: Read saml_enabled from the public config response. When true, display option [3] Sign in with SAML SSO. This routes through the same device authorization flow — the user authenticates via SAML in the browser and the CLI receives the token via polling.

Fix 2: Browser open error on WSL

Problem: webbrowser.open() on WSL calls gio (a Linux desktop tool) which fails with "Operation not supported" since WSL has no native browser. The error message is printed to the terminal, confusing users.

Fix: Replace webbrowser.open() with platform-aware subprocess calls:

  • macOS: open <url>
  • Linux (WSL): powershell.exe Start-Process <url> — opens in the Windows default browser
  • Linux (native): xdg-open <url>
  • Windows: falls back to webbrowser.open()

WSL detection uses wslpath -w / (returns 0 only on WSL). All subprocess calls suppress stderr/stdout to avoid terminal pollution.

How has this been tested

  • Manual testing on WSL:
    • With saml_enabled: true in server config → option [3] appears
    • With saml_enabled: false → only options [1] and [2] shown
    • Option [2] opens browser via powershell.exe without gio errors
    • Option [3] routes through device flow correctly
  • Verified GET /api/v1/config/public returns saml_enabled field (confirmed via curl)

shreem26 added 2 commits June 1, 2026 12:59
The login menu only showed 2 options (password + browser) even when SAML
was configured on the server. The saml_enabled field from
/api/v1/config/public was never read by the CLI.

Now reads saml_enabled from the public config response and shows option
[3] Sign in with SAML SSO when it is true. Routes through the same
device authorization flow (user authenticates via SAML in the browser,
CLI receives the token).

SPDX-FileCopyrightText: 2026 Shreem Seth <shreemseth26@gmail.com>
SPDX-License-Identifier: AGPL-3.0-only
On WSL, webbrowser.open() calls gio which prints 'Operation not
supported' to the terminal since WSL has no native browser. On macOS,
webbrowser.open() sometimes opens the wrong browser.

Replace with platform-specific subprocess calls:
- macOS: open <url>
- Linux (WSL): powershell.exe Start-Process <url>
- Linux (native): xdg-open <url>
- Windows: falls back to webbrowser.open()

All subprocess calls suppress stderr/stdout to avoid polluting the
terminal output.

SPDX-FileCopyrightText: 2026 Shreem Seth <shreemseth26@gmail.com>
SPDX-License-Identifier: AGPL-3.0-only
@github-actions github-actions Bot added the cli CLI changes label Jun 1, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 0% with 19 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
observal_cli/cmd_auth.py 0.00% 19 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant