Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerkstage.dev

Creating and verifying a domain

Domains can be added and verified under an organization by an administrator. In order to enable this feature, go to the Clerk Dashboard and navigate to the Organizations Settings page. Toggle on Verified domains. The only parameter needed to create an organization domain is the name.

Domains can be verified through an email verfication code sent to an email that matches the domain. If the administrator adding the domain already has a verified email using that domain in their account, the domain will be automatically verified.

An application instance may only have one verified domain of the same name, and an organization may only have one domain of the same name (verified or unverified).

Enrollment modes

Once a domain is created and verified, an administrator can choose between two enrollment modes to enable new ways for users to join organizations.

  • automatic_invitation - During sign-up, a user will receive an invitation for the organization if their email's domain matches the verified domain. The user will join the organization if they accept the automatic invitation.
  • automatic_suggestion - During sign-up, a user will receive a suggestion for the organization if their email's domain matches the verified domain. The user can request to join, and an administrator must accept this request before the user can join the organization.

Usage

const { organization, domains } = useOrganization(); // create domain const domain = await organization.createDomain("example.com") // prepare email verification domain.prepareAffiliationVerification({affiliationEmailAddress: "foo@example.com"}) // attempt email verification domain.attemptAffiliationVerification({code: "123456"}) // update domain enrollment mode domain.updateEnrollmentMode({enrollmentMode: "automatic_invitation"})

What did you think of this content?

Clerk © 2023