Closed
Conversation
added 3 commits
April 5, 2026 02:17
Problem:
- SSO login page only worked on the platform domain (bigbear.cool), not on tenant
subdomains (e.g., acme.bigbear.cool)
- SSO callback URLs were constructed using PUBLIC_BASE_URL instead of the request
Host header, causing callbacks to redirect to the wrong domain
- No way to create companies with custom slugs for branded SSO subdomain URLs
- Login page redirected to platform domain instead of staying on tenant subdomain
after successful SSO authentication
Changes:
- backend/app/api/admin.py:
- Add slug field to CompanyCreateRequest schema
- Add CompanyUpdateRequest schema for updating company settings
- Add PUT /companies/{company_id} endpoint for updating company SSO config
- backend/app/api/tenants.py:
- Add slug field to TenantCreate schema
- self_create_company: use custom slug if provided, else auto-generate
- self_create_company: auto-assign sso_domain via platform_service.get_tenant_sso_base_url()
- backend/app/core/public_url.py: New utility file with:
- get_public_base_url_sync(): sync version reads env var
- get_public_base_url_async(): async version reads from database
- get_sso_domain_from_slug(): generate subdomain URL from slug
- backend/alembic/versions/add_participants.py: Fix migration bug (username column doesn't exist)
- frontend/nginx.conf: Change server_name from "localhost" to "_" to accept
requests from any hostname (required for tenant subdomains)
- frontend/vite.config.ts: Add allowedHosts for .clawith.ai and .bigbear.cool domains
- frontend/Dockerfile: Add VITE_PUBLIC_URL build arg
- frontend/src/pages/AdminCompanies.tsx:
- Add newSlug state and slug input in Create Company form
- Add editingCompany state and Edit button for each company
- Add EditCompanyModal rendering when editingCompany is set
- EditCompanyModal: add name and slug fields for editing
- frontend/src/services/api.ts:
- Update createCompany type to include optional slug
- Update updateCompany to use /admin/companies/{id} endpoint
- docker-compose.yml: Add VITE_PUBLIC_URL environment variable to frontend service
Features:
- Admin can specify custom slug when creating companies
- Admin can edit company name and slug via Edit button
- Admin can edit company settings including SSO configuration
- Self-service company creation auto-generates sso_domain
- SSO callbacks use correct tenant subdomain
- Enterprise users can login at tenant subdomain
- Login redirect stays on tenant subdomain after SSO
…ername column The migration was trying to select from the users table using a username column that doesn't exist in the current schema. Fixed by using display_name directly.
Contributor
|
Thanks for this contribution. This PR covers several independent ideas, some of which are genuinely useful — particularly the ability to customize a company's slug for cleaner SSO subdomains. Rather than asking you to split and resubmit, we'd like to collect your requirements and plan the right solutions into a future release. Could you walk us through: For custom slug / SSO subdomain support:
For the Feishu org sync change:
We'll look at all of these holistically across #293, #294, and #295 and plan them together. Closing for now. |
Author
|
Hi wisdomqin, thanks for the feedback!
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Checklist