feat(integrations): route OAuth callbacks back to originating workspace host

This commit is contained in:
Philipinho
2026-05-23 12:32:18 +01:00
parent 2f313187ab
commit 91a2abd8d3
3 changed files with 43 additions and 4 deletions
@@ -18,4 +18,20 @@ export class DomainService {
const protocol = this.environmentService.isHttps() ? 'https' : 'http';
return `${protocol}://${hostname}.${domain}`;
}
// Canonical workspace URL: prefers customDomain, falls back to {hostname}.{cloud-domain},
// falls back to APP_URL for self-hosted. Used for multi-tenant OAuth return-redirects.
getWorkspaceUrl(workspace: {
hostname?: string | null;
customDomain?: string | null;
}): string {
if (!this.environmentService.isCloud()) {
return this.environmentService.getAppUrl();
}
if (workspace.customDomain) {
const protocol = this.environmentService.isHttps() ? 'https' : 'http';
return `${protocol}://${workspace.customDomain}`;
}
return this.getUrl(workspace.hostname ?? undefined);
}
}