Tenant authorization and domain security
Secure customer custom domains in a multi-tenant app: authorize every call by tenant, rate-limit changes, and prevent abandoned-domain takeover.
Authorize every add, get, verify, refresh, and remove by tenant. Normalize before uniqueness checks. Rate-limit mutations. Remove provider configuration when a tenant disconnects a hostname. Do not reassign an abandoned hostname until provider ownership is safely re-established.
Never trust current DNS resolution as ownership proof, collect registrar passwords, or expose provider credentials. Provider verification is authoritative. To prove which tenant controls a hostname, issue each tenant its own TXT token and check it before attaching the domain; Domain verification with TXT records has a sample.
Read next: Build a settings page.