Skip to content

fix: Verify unverified domains when linking to org#828

Merged
bokelley merged 1 commit into
mainfrom
bokelley/fix-domain-link-ui
Jan 20, 2026
Merged

fix: Verify unverified domains when linking to org#828
bokelley merged 1 commit into
mainfrom
bokelley/fix-domain-link-ui

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

  • Fix domain linking for organizations with unverified domains
  • The POST /api/admin/organizations/:orgId/domains endpoint now correctly verifies existing unverified domains instead of returning early with "Domain already associated"

Problem

When clicking "Link to Org" for an organization in the "Organizations Without Verified Domains" section on the domain health page, the API returned success but the org remained in the list. This happened because:

  1. The domain existed in organization_domains table but with verified = false
  2. The endpoint returned early with "Domain already associated" without checking the verified status
  3. The "orgs without verified domains" query requires verified = true

Solution

Added a check for the verified flag before returning early. If the domain exists for this org but is not verified, the code continues to the verification logic which:

  • Verifies/adds the domain in WorkOS
  • Updates the local DB with verified = true

Test plan

  • TypeScript compiles without errors
  • All tests pass
  • Code review completed
  • Domain health page loads correctly in dev environment

🤖 Generated with Claude Code

When clicking "Link to Org" for an organization in the "Organizations
Without Verified Domains" section, the API was returning success but
the org remained in the list. This happened because the domain existed
in organization_domains with verified=false, and the endpoint returned
early without checking the verified status.

Now the endpoint checks if the existing domain is verified before
returning early. If not verified, it continues to the verification
logic which updates both WorkOS and the local DB.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley bokelley merged commit dd1df24 into main Jan 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant