fix(cli): pass api_url to UI for OAuth to ensure same backend is used

Problem

Fixes https://gitlab.com/postgres-ai/platform/-/issues/370

When a user has a custom apiBaseUrl in their CLI config, OAuth authentication fails with "OAuth session not found" because CLI and UI hit different backends.

Root Cause

  1. CLI calls oauth_init on configured API (e.g., staging v2.postgres.ai) → session created there
  2. UI calls oauth_approve on its default API (production postgres.ai) → session NOT found

Solution

Pass api_url parameter to the UI so it calls oauth_approve on the same backend where oauth_init created the session.

- const authUrl = `${uiBaseUrl}/cli/auth?state=...&redirect_uri=...`
+ const authUrl = `${uiBaseUrl}/cli/auth?state=...&redirect_uri=...&api_url=${apiBaseUrl}`
  • Requires UI change in platform-ui repo
Edited by Nikolay Samokhvalov

Merge request reports

Loading