Skip to content

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

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

fix(auth): SAML login option + WSL browser open#1327
shreem26 wants to merge 3 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)

@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 22 lines in your changes missing coverage. Please review.

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

📢 Thoughts on this report? Let us know!

@shreem26 shreem26 force-pushed the fix/auth-login-improvements branch from aef8f62 to 97c39fd Compare June 3, 2026 06:27
shreem26 added 2 commits June 3, 2026 06:42
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
@shreem26 shreem26 force-pushed the fix/auth-login-improvements branch from 97c39fd to 5d4c633 Compare June 3, 2026 06:42
@github-actions github-actions Bot added the server Pull request touches server code label Jun 3, 2026
@shreem26 shreem26 marked this pull request as ready for review June 3, 2026 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI changes server Pull request touches server code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant