Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
fix(console): accept Core's sign-in step on the server's API host (#853)
Louis Amaudruzb9e55c92ecb5
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8e4fec846..5dcd426d5 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1624,6 +1624,14 @@ version of their own to them without also giving them a release of their own.### [Unreleased]+#### Fixed+- **Signing in to a service through Core works on a server whose gateway and+ API are on different hosts.** Core sends the browser through its own+ authorize step at its public address, the API's host, where the vendor+ returns it; Console only accepted the gateway's host and refused the sign-in+ as an invalid URL. It now accepts either of the server's own origins, over+ HTTPS. Google Workspace connects this way.+### [0.39.0] - 2026-10-12#### Addeddiff --git a/console/apps/switch-console-desktop/src/main/core/managed-switch-server/env-file.test.ts b/console/apps/switch-console-desktop/src/main/core/managed-switch-server/env-file.test.tsindex 0ea27872e..f4bb81338 100644--- a/console/apps/switch-console-desktop/src/main/core/managed-switch-server/env-file.test.ts+++ b/console/apps/switch-console-desktop/src/main/core/managed-switch-server/env-file.test.ts@@ -155,6 +155,9 @@ describe('buildEnvFile', () => {'TEAMS_APP_PRIVACY_URL','TEAMS_APP_TERMS_URL','TEAMS_APP_NAME',+ // Written, but empty on purpose: a managed stack starts with no feature+ // flag on (MANAGED_SERVER_FEATURE_FLAGS).+ 'FEATURE_FLAGS_ENABLED',]);const missing = [...interpolated]diff --git a/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.test.ts b/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.test.tsindex 15bea9084..019f70b56 100644--- a/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.test.ts+++ b/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.test.ts@@ -116,6 +116,7 @@ const SERVER = {id: 'srv-1',name: 'S',gatewayUrl: 'https://switch.example.com',+ apiUrl: 'https://switch-api.example.com',managed: false,} as never;const MANAGED = {@@ -1317,7 +1318,18 @@ describe('a service sign-in', () => {);});+ it('accepts Core’s authorize step on the server’s API host, where it returns', async () => {+ const url = `https://switch-api.example.com/gateway/service-connections/example/flows/authorize?state=${state}`;+ answer({ id: state, mode: 'core', url });+ expect((await startServiceConnection(SERVER, 'example', input)).url).toBe(url);+ });+it.each([+ [+ 'the server’s API host over plain HTTP',+ 'core',+ `http://switch-api.example.com/gateway/service-connections/example/flows/authorize?state=${state}`,+ ],['another server in core mode','core',diff --git a/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.ts b/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.tsindex 73839fac4..9fbde8c17 100644--- a/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.ts+++ b/console/apps/switch-console-desktop/src/main/core/switch-servers/gateway-client.ts@@ -2961,6 +2961,11 @@ const serviceFlows = (service: string) =>* Begin signing in to `service` through Switch's generic OAuth flow. The URL* the browser is sent to is checked: Core's own authorize step on this server,* or the vendor's page returning to this Console's listener with this state.+ *+ * Core's authorize step is at its public address (`GATEWAY_PUBLIC_URL`), the+ * host the vendor returns the browser to and whose cookie ties that return to+ * the browser. A server that serves its gateway and its API on two hosts has it+ * on the API's, so either of the server's own origins is accepted, over HTTPS.*/export async function startServiceConnection(server: SwitchServer,@@ -2984,7 +2989,8 @@ export async function startServiceConnection(!url.username &&!url.password &&(value.mode === 'core'- ? url.origin === new URL(server.gatewayUrl).origin &&+ ? url.protocol === 'https:' &&+ [server.gatewayUrl, server.apiUrl].some((own) => new URL(own).origin === url.origin) &&url.pathname === `/gateway${serviceFlows(service)}/authorize` &&url.searchParams.get('state') === value.id: url.protocol === 'https:' &&